mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-21 20:36:05 +03:00
Sanity check to ensure that GraphQL query is string
This commit is contained in:
parent
3f909e3e11
commit
34ca931533
@ -18,7 +18,7 @@ class GraphQL
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @param $requestString
|
||||
* @param string|DocumentNode $requestString
|
||||
* @param mixed $rootValue
|
||||
* @param array|null $variableValues
|
||||
* @param string|null $operationName
|
||||
@ -41,7 +41,7 @@ class GraphQL
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @param $requestString
|
||||
* @param string|DocumentNode $requestString
|
||||
* @param null $rootValue
|
||||
* @param null $variableValues
|
||||
* @param null $operationName
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace GraphQL\Language;
|
||||
|
||||
use GraphQL\Utils;
|
||||
|
||||
class Source
|
||||
{
|
||||
/**
|
||||
@ -20,6 +22,11 @@ class Source
|
||||
|
||||
public function __construct($body, $name = null)
|
||||
{
|
||||
Utils::invariant(
|
||||
is_string($body),
|
||||
'GraphQL query body is expected to be string, but got ' . Utils::getVariableType($body)
|
||||
);
|
||||
|
||||
$this->body = $body;
|
||||
$this->length = mb_strlen($body, 'UTF-8');
|
||||
$this->name = $name ?: 'GraphQL';
|
||||
|
Loading…
Reference in New Issue
Block a user