mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 04:46:04 +03:00
TASK: Allow ScalarType extensions
This commit is contained in:
parent
b0ee36feb4
commit
1dc2b939cb
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace GraphQL\Type\Definition;
|
namespace GraphQL\Type\Definition;
|
||||||
|
|
||||||
use GraphQL\Language\AST\ScalarTypeDefinitionNode;
|
use GraphQL\Language\AST\ScalarTypeDefinitionNode;
|
||||||
|
use GraphQL\Language\AST\ScalarTypeExtensionNode;
|
||||||
use GraphQL\Utils\Utils;
|
use GraphQL\Utils\Utils;
|
||||||
use function is_string;
|
use function is_string;
|
||||||
|
|
||||||
@ -31,15 +32,19 @@ abstract class ScalarType extends Type implements OutputType, InputType, LeafTyp
|
|||||||
/** @var ScalarTypeDefinitionNode|null */
|
/** @var ScalarTypeDefinitionNode|null */
|
||||||
public $astNode;
|
public $astNode;
|
||||||
|
|
||||||
|
/** @var ScalarTypeExtensionNode[] */
|
||||||
|
public $extensionASTNodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed[] $config
|
* @param mixed[] $config
|
||||||
*/
|
*/
|
||||||
public function __construct(array $config = [])
|
public function __construct(array $config = [])
|
||||||
{
|
{
|
||||||
$this->name = $config['name'] ?? $this->tryInferName();
|
$this->name = $config['name'] ?? $this->tryInferName();
|
||||||
$this->description = $config['description'] ?? $this->description;
|
$this->description = $config['description'] ?? $this->description;
|
||||||
$this->astNode = $config['astNode'] ?? null;
|
$this->astNode = $config['astNode'] ?? null;
|
||||||
$this->config = $config;
|
$this->extensionASTNodes = $config['extensionASTNodes'] ?? null;
|
||||||
|
$this->config = $config;
|
||||||
|
|
||||||
Utils::invariant(is_string($this->name), 'Must provide name.');
|
Utils::invariant(is_string($this->name), 'Must provide name.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user