mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-24 22:06:04 +03:00
Fixed misspelling "defintion" in several places
This commit is contained in:
parent
23169603fc
commit
f39f0f5517
@ -45,7 +45,7 @@ use function sprintf;
|
|||||||
class ASTDefinitionBuilder
|
class ASTDefinitionBuilder
|
||||||
{
|
{
|
||||||
/** @var Node[] */
|
/** @var Node[] */
|
||||||
private $typeDefintionsMap;
|
private $typeDefinitionsMap;
|
||||||
|
|
||||||
/** @var callable */
|
/** @var callable */
|
||||||
private $typeConfigDecorator;
|
private $typeConfigDecorator;
|
||||||
@ -60,16 +60,16 @@ class ASTDefinitionBuilder
|
|||||||
private $cache;
|
private $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Node[] $typeDefintionsMap
|
* @param Node[] $typeDefinitionsMap
|
||||||
* @param bool[] $options
|
* @param bool[] $options
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
array $typeDefintionsMap,
|
array $typeDefinitionsMap,
|
||||||
$options,
|
$options,
|
||||||
callable $resolveType,
|
callable $resolveType,
|
||||||
?callable $typeConfigDecorator = null
|
?callable $typeConfigDecorator = null
|
||||||
) {
|
) {
|
||||||
$this->typeDefintionsMap = $typeDefintionsMap;
|
$this->typeDefinitionsMap = $typeDefinitionsMap;
|
||||||
$this->typeConfigDecorator = $typeConfigDecorator;
|
$this->typeConfigDecorator = $typeConfigDecorator;
|
||||||
$this->options = $options;
|
$this->options = $options;
|
||||||
$this->resolveType = $resolveType;
|
$this->resolveType = $resolveType;
|
||||||
@ -199,12 +199,12 @@ class ASTDefinitionBuilder
|
|||||||
private function internalBuildType($typeName, $typeNode = null)
|
private function internalBuildType($typeName, $typeNode = null)
|
||||||
{
|
{
|
||||||
if (! isset($this->cache[$typeName])) {
|
if (! isset($this->cache[$typeName])) {
|
||||||
if (isset($this->typeDefintionsMap[$typeName])) {
|
if (isset($this->typeDefinitionsMap[$typeName])) {
|
||||||
$type = $this->makeSchemaDef($this->typeDefintionsMap[$typeName]);
|
$type = $this->makeSchemaDef($this->typeDefinitionsMap[$typeName]);
|
||||||
if ($this->typeConfigDecorator) {
|
if ($this->typeConfigDecorator) {
|
||||||
$fn = $this->typeConfigDecorator;
|
$fn = $this->typeConfigDecorator;
|
||||||
try {
|
try {
|
||||||
$config = $fn($type->config, $this->typeDefintionsMap[$typeName], $this->typeDefintionsMap);
|
$config = $fn($type->config, $this->typeDefinitionsMap[$typeName], $this->typeDefinitionsMap);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
sprintf('Type config decorator passed to %s threw an error ', static::class) .
|
sprintf('Type config decorator passed to %s threw an error ', static::class) .
|
||||||
@ -225,7 +225,7 @@ class ASTDefinitionBuilder
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$type = $this->makeSchemaDefFromConfig($this->typeDefintionsMap[$typeName], $config);
|
$type = $this->makeSchemaDefFromConfig($this->typeDefinitionsMap[$typeName], $config);
|
||||||
}
|
}
|
||||||
$this->cache[$typeName] = $type;
|
$this->cache[$typeName] = $type;
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,7 +135,7 @@ class BuildSchema
|
|||||||
'subscription' => isset($this->nodeMap['Subscription']) ? 'Subscription' : null,
|
'subscription' => isset($this->nodeMap['Subscription']) ? 'Subscription' : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$defintionBuilder = new ASTDefinitionBuilder(
|
$DefinitionBuilder = new ASTDefinitionBuilder(
|
||||||
$this->nodeMap,
|
$this->nodeMap,
|
||||||
$this->options,
|
$this->options,
|
||||||
static function ($typeName) {
|
static function ($typeName) {
|
||||||
@ -145,8 +145,8 @@ class BuildSchema
|
|||||||
);
|
);
|
||||||
|
|
||||||
$directives = array_map(
|
$directives = array_map(
|
||||||
static function ($def) use ($defintionBuilder) {
|
static function ($def) use ($DefinitionBuilder) {
|
||||||
return $defintionBuilder->buildDirective($def);
|
return $DefinitionBuilder->buildDirective($def);
|
||||||
},
|
},
|
||||||
$directiveDefs
|
$directiveDefs
|
||||||
);
|
);
|
||||||
@ -188,23 +188,23 @@ class BuildSchema
|
|||||||
|
|
||||||
return new Schema([
|
return new Schema([
|
||||||
'query' => isset($operationTypes['query'])
|
'query' => isset($operationTypes['query'])
|
||||||
? $defintionBuilder->buildType($operationTypes['query'])
|
? $DefinitionBuilder->buildType($operationTypes['query'])
|
||||||
: null,
|
: null,
|
||||||
'mutation' => isset($operationTypes['mutation'])
|
'mutation' => isset($operationTypes['mutation'])
|
||||||
? $defintionBuilder->buildType($operationTypes['mutation'])
|
? $DefinitionBuilder->buildType($operationTypes['mutation'])
|
||||||
: null,
|
: null,
|
||||||
'subscription' => isset($operationTypes['subscription'])
|
'subscription' => isset($operationTypes['subscription'])
|
||||||
? $defintionBuilder->buildType($operationTypes['subscription'])
|
? $DefinitionBuilder->buildType($operationTypes['subscription'])
|
||||||
: null,
|
: null,
|
||||||
'typeLoader' => static function ($name) use ($defintionBuilder) {
|
'typeLoader' => static function ($name) use ($DefinitionBuilder) {
|
||||||
return $defintionBuilder->buildType($name);
|
return $DefinitionBuilder->buildType($name);
|
||||||
},
|
},
|
||||||
'directives' => $directives,
|
'directives' => $directives,
|
||||||
'astNode' => $schemaDef,
|
'astNode' => $schemaDef,
|
||||||
'types' => function () use ($defintionBuilder) {
|
'types' => function () use ($DefinitionBuilder) {
|
||||||
$types = [];
|
$types = [];
|
||||||
foreach ($this->nodeMap as $name => $def) {
|
foreach ($this->nodeMap as $name => $def) {
|
||||||
$types[] = $defintionBuilder->buildType($def->name->value);
|
$types[] = $DefinitionBuilder->buildType($def->name->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $types;
|
return $types;
|
||||||
|
@ -80,28 +80,28 @@ class ValuesTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
private static function getVariableDefinitionNodes() : array
|
private static function getVariableDefinitionNodes() : array
|
||||||
{
|
{
|
||||||
$idInputDefinition = new VariableDefinitionNode([
|
$idInputDefinition = new VariableDefinitionNode([
|
||||||
'variable' => new VariableNode(['name' => new NameNode(['value' => 'idInput'])]),
|
'variable' => new VariableNode(['name' => new NameNode(['value' => 'idInput'])]),
|
||||||
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'ID'])]),
|
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'ID'])]),
|
||||||
]);
|
]);
|
||||||
$boolInputDefinition = new VariableDefinitionNode([
|
$boolInputDefinition = new VariableDefinitionNode([
|
||||||
'variable' => new VariableNode(['name' => new NameNode(['value' => 'boolInput'])]),
|
'variable' => new VariableNode(['name' => new NameNode(['value' => 'boolInput'])]),
|
||||||
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Boolean'])]),
|
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Boolean'])]),
|
||||||
]);
|
]);
|
||||||
$intInputDefinition = new VariableDefinitionNode([
|
$intInputDefinition = new VariableDefinitionNode([
|
||||||
'variable' => new VariableNode(['name' => new NameNode(['value' => 'intInput'])]),
|
'variable' => new VariableNode(['name' => new NameNode(['value' => 'intInput'])]),
|
||||||
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Int'])]),
|
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Int'])]),
|
||||||
]);
|
]);
|
||||||
$stringInputDefintion = new VariableDefinitionNode([
|
$stringInputDefinition = new VariableDefinitionNode([
|
||||||
'variable' => new VariableNode(['name' => new NameNode(['value' => 'stringInput'])]),
|
'variable' => new VariableNode(['name' => new NameNode(['value' => 'stringInput'])]),
|
||||||
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'String'])]),
|
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'String'])]),
|
||||||
]);
|
]);
|
||||||
$floatInputDefinition = new VariableDefinitionNode([
|
$floatInputDefinition = new VariableDefinitionNode([
|
||||||
'variable' => new VariableNode(['name' => new NameNode(['value' => 'floatInput'])]),
|
'variable' => new VariableNode(['name' => new NameNode(['value' => 'floatInput'])]),
|
||||||
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Float'])]),
|
'type' => new NamedTypeNode(['name' => new NameNode(['value' => 'Float'])]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return [$idInputDefinition, $boolInputDefinition, $intInputDefinition, $stringInputDefintion, $floatInputDefinition];
|
return [$idInputDefinition, $boolInputDefinition, $intInputDefinition, $stringInputDefinition, $floatInputDefinition];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetBooleanVariableValues() : void
|
public function testGetBooleanVariableValues() : void
|
||||||
|
Loading…
Reference in New Issue
Block a user