Merge pull request #386 from nagledb/fix-definition-spelling

Fixed misspelling "defintion" in several places
This commit is contained in:
Vladimir Razuvaev 2018-11-05 03:19:01 +07:00 committed by GitHub
commit 98807286f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 24 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -92,7 +92,7 @@ class ValuesTest extends TestCase
'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'])]),
]); ]);
@ -101,7 +101,7 @@ class ValuesTest extends TestCase
'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