@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | 'args' => [ |
24 | 24 | 'ids' => new ListType(new NonNullType(new IdType())), |
25 | 25 | ], |
26 | - 'resolve' => function () { |
|
26 | + 'resolve' => function() { |
|
27 | 27 | return 'item'; |
28 | 28 | }, |
29 | 29 | ], |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'args' => [ |
101 | 101 | 'sortOrder' => new StringType(), |
102 | 102 | ], |
103 | - 'resolve' => function ($args) { |
|
103 | + 'resolve' => function($args) { |
|
104 | 104 | return sprintf('Result with %s order', empty($args['sortOrder']) ? 'default' : $args['sortOrder']); |
105 | 105 | }, |
106 | 106 | ], |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | foreach (TypeFactory::getScalarTypesNames() as $typeName) { |
24 | 24 | $scalarType = TypeFactory::getScalarType($typeName); |
25 | - $testDataMethod = 'get' . $typeName . 'TestData'; |
|
25 | + $testDataMethod = 'get'.$typeName.'TestData'; |
|
26 | 26 | |
27 | 27 | $this->assertNotEmpty($scalarType->getDescription()); |
28 | 28 | $this->assertEquals($scalarType->getKind(), TypeMap::KIND_SCALAR); |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $this->assertParse($scalarType, $data, $serialized, $typeName); |
39 | 39 | |
40 | 40 | if ($isValid) { |
41 | - $this->assertTrue($scalarType->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
41 | + $this->assertTrue($scalarType->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
42 | 42 | } else { |
43 | - $this->assertFalse($scalarType->isValidValue($data), $typeName . ' validation for :' . serialize($data)); |
|
43 | + $this->assertFalse($scalarType->isValidValue($data), $typeName.' validation for :'.serialize($data)); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | private function assertSerialization(AbstractScalarType $object, $input, $expected) |
63 | 63 | { |
64 | - $this->assertEquals($expected, $object->serialize($input), $object->getName() . ' serialize for: ' . serialize($input)); |
|
64 | + $this->assertEquals($expected, $object->serialize($input), $object->getName().' serialize for: '.serialize($input)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | private function assertParse(AbstractScalarType $object, $input, $expected, $typeName) |
@@ -72,6 +72,6 @@ discard block |
||
72 | 72 | $parsed = \DateTime::createFromFormat('Y-m-d H:i:s', $parsed->format('Y-m-d H:i:s')); |
73 | 73 | } |
74 | 74 | |
75 | - $this->assertEquals($expected, $parsed, $object->getName() . ' parse for: ' . serialize($input)); |
|
75 | + $this->assertEquals($expected, $parsed, $object->getName().' parse for: '.serialize($input)); |
|
76 | 76 | } |
77 | 77 | } |
@@ -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 |