@@ -77,7 +77,7 @@ |
||
| 77 | 77 | |
| 78 | 78 | public function parseValue($value) |
| 79 | 79 | { |
| 80 | - foreach ((array) $value as $keyValue => $valueItem) { |
|
| 80 | + foreach ((array)$value as $keyValue => $valueItem) { |
|
| 81 | 81 | $value[$keyValue] = $this->getItemType()->parseValue($valueItem); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $directiveList; |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param \Youshido\GraphQL\Schema\AbstractSchema $contextObject |
|
| 33 | + */ |
|
| 31 | 34 | public function __construct(array $configData, $contextObject = null, $finalClass = false) |
| 32 | 35 | { |
| 33 | 36 | $this->typesList = new SchemaTypesList(); |
@@ -88,7 +91,7 @@ discard block |
||
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | /** |
| 91 | - * @param $query AbstractObjectType |
|
| 94 | + * @param ObjectType $query AbstractObjectType |
|
| 92 | 95 | * |
| 93 | 96 | * @return SchemaConfig |
| 94 | 97 | */ |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | public function addDirective(DirectiveInterface $directive) |
| 42 | 42 | { |
| 43 | 43 | $directiveName = $this->getDirectiveName($directive); |
| 44 | - if ($this->isDirectiveNameRegistered($directiveName)) return $this; |
|
| 44 | + if ($this->isDirectiveNameRegistered($directiveName)) { |
|
| 45 | + return $this; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $this->directivesList[$directiveName] = $directive; |
| 47 | 49 | |
@@ -50,7 +52,9 @@ discard block |
||
| 50 | 52 | |
| 51 | 53 | private function getDirectiveName($directive) |
| 52 | 54 | { |
| 53 | - if (is_string($directive)) return $directive; |
|
| 55 | + if (is_string($directive)) { |
|
| 56 | + return $directive; |
|
| 57 | + } |
|
| 54 | 58 | if (is_object($directive) && $directive instanceof DirectiveInterface) { |
| 55 | 59 | return $directive->getName(); |
| 56 | 60 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | 'type' => new NonNullType(new ListType(new NonNullType(new InputValueType()))), |
| 60 | 60 | 'resolve' => [$this, 'resolveArgs'], |
| 61 | 61 | ]) |
| 62 | - ->addField('locations',[ |
|
| 62 | + ->addField('locations', [ |
|
| 63 | 63 | 'type' => new NonNullType(new ListType(new NonNullType(new DirectiveLocationType()))), |
| 64 | 64 | 'resolve' => [$this, 'resolveLocations'], |
| 65 | 65 | ]); |
@@ -253,9 +253,9 @@ |
||
| 253 | 253 | $value = substr($this->source, $start, $this->pos - $start); |
| 254 | 254 | |
| 255 | 255 | if (strpos($value, '.') === false) { |
| 256 | - $value = (int) $value; |
|
| 256 | + $value = (int)$value; |
|
| 257 | 257 | } else { |
| 258 | - $value = (float) $value; |
|
| 258 | + $value = (float)$value; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return new Token(Token::TYPE_NUMBER, $this->getLine(), $this->getColumn(), $value); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | protected function findVariable($name) |
| 237 | 237 | { |
| 238 | - foreach ((array) $this->data['variables'] as $variable) { |
|
| 238 | + foreach ((array)$this->data['variables'] as $variable) { |
|
| 239 | 239 | /** @var $variable Variable */ |
| 240 | 240 | if ($variable->getName() === $name) { |
| 241 | 241 | return $variable; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | protected function matchMulti($types) |
| 480 | 480 | { |
| 481 | - foreach ((array) $types as $type) { |
|
| 481 | + foreach ((array)$types as $type) { |
|
| 482 | 482 | if ($this->peek()->getType() === $type) { |
| 483 | 483 | return true; |
| 484 | 484 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | /** @var AbstractObjectType $objectType */ |
| 28 | 28 | if (!(TypeService::isObjectType($objectType) || TypeService::isInputObjectType($objectType)) || !$objectType->hasField($ast->getName())) { |
| 29 | - $availableFieldNames = implode(', ', array_map(function (FieldInterface $field) { |
|
| 29 | + $availableFieldNames = implode(', ', array_map(function(FieldInterface $field) { |
|
| 30 | 30 | return sprintf('"%s"', $field->getName()); |
| 31 | 31 | }, $objectType->getFields())); |
| 32 | 32 | throw new ResolveException(sprintf('Field "%s" not found in type "%s". Available fields are: %s', $ast->getName(), $objectType->getNamedType()->getName(), $availableFieldNames), $ast->getLocation()); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function assertValidArguments(FieldInterface $field, AstFieldInterface $query, Request $request) |
| 37 | 37 | { |
| 38 | - $requiredArguments = array_filter($field->getArguments(), function (InputField $argument) { |
|
| 38 | + $requiredArguments = array_filter($field->getArguments(), function(InputField $argument) { |
|
| 39 | 39 | return $argument->getType()->getKind() === TypeMap::KIND_NON_NULL; |
| 40 | 40 | }); |
| 41 | 41 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | public function testMethods() |
| 23 | 23 | { |
| 24 | - $fieldAst = new FieldAST('name', null, [], [], new Location(1,1)); |
|
| 24 | + $fieldAst = new FieldAST('name', null, [], [], new Location(1, 1)); |
|
| 25 | 25 | $field = new Field(['name' => 'id', 'type' => new IntType()]); |
| 26 | 26 | $returnType = new IntType(); |
| 27 | 27 | $executionContext = new ExecutionContext(new TestSchema()); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | 'description' => 'latest description', |
| 137 | 137 | 'deprecationReason' => 'for test', |
| 138 | 138 | 'isDeprecated' => true, |
| 139 | - 'resolve' => function () { |
|
| 139 | + 'resolve' => function() { |
|
| 140 | 140 | return [ |
| 141 | 141 | 'id' => 1, |
| 142 | 142 | 'name' => 'Alex' |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | ['name' => 'String', 'fields' => null], |
| 203 | 203 | ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]], |
| 204 | 204 | ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]], |
| 205 | - ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]], |
|
| 205 | + ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []], ]], |
|
| 206 | 206 | ['name' => 'Boolean', 'fields' => null], |
| 207 | - ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]], |
|
| 207 | + ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ]], |
|
| 208 | 208 | ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]], |
| 209 | 209 | ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'locations', 'args' => []]]], |
| 210 | 210 | ['name' => '__DirectiveLocation', 'fields' => null], |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | 'id' => ['type' => new IntType()], |
| 293 | 293 | 'name' => ['type' => new IntType()], |
| 294 | 294 | ], |
| 295 | - 'resolveType' => function ($type) { |
|
| 295 | + 'resolveType' => function($type) { |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | ]); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $unionType = new UnionType([ |
| 321 | 321 | 'name' => 'UnionType', |
| 322 | 322 | 'types' => [$object1, $object2], |
| 323 | - 'resolveType' => function () { |
|
| 323 | + 'resolveType' => function() { |
|
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | ]); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | 'args' => [ |
| 332 | 332 | 'id' => ['type' => TypeMap::TYPE_INT] |
| 333 | 333 | ], |
| 334 | - 'resolve' => function () { |
|
| 334 | + 'resolve' => function() { |
|
| 335 | 335 | return [ |
| 336 | 336 | 'id' => 1, |
| 337 | 337 | 'name' => 'Alex' |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | ] |
| 358 | 358 | ]) |
| 359 | 359 | ], |
| 360 | - 'resolve' => function () { |
|
| 360 | + 'resolve' => function() { |
|
| 361 | 361 | return null; |
| 362 | 362 | } |
| 363 | 363 | ])); |