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