@@ -21,14 +21,14 @@ |
||
21 | 21 | |
22 | 22 | public function testScalarTypeCheck() |
23 | 23 | { |
24 | - foreach($this->getScalarTypes() as $type) { |
|
24 | + foreach ($this->getScalarTypes() as $type) { |
|
25 | 25 | $this->assertTrue(TypeMap::isInputType($type)); |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testScalarTypeObjectCreation() |
30 | 30 | { |
31 | - foreach($this->getScalarTypes() as $type) { |
|
31 | + foreach ($this->getScalarTypes() as $type) { |
|
32 | 32 | $object = TypeMap::getScalarTypeObject($type); |
33 | 33 | $this->assertEquals($object->getKind(), TypeMap::KIND_SCALAR); |
34 | 34 | $this->assertEquals($object->getName(), $type); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - $requiredFields = array_filter($this->getConfig()->getFields(), function (Field $field) { |
|
40 | + $requiredFields = array_filter($this->getConfig()->getFields(), function(Field $field) { |
|
41 | 41 | return $field->getConfig()->isRequired(); |
42 | 42 | }); |
43 | 43 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | ->addField('kind', 'string') |
22 | 22 | ->addField('description', 'string') |
23 | 23 | ->addField('ofType', new QueryListType(), [ |
24 | - 'resolve' => function () { |
|
24 | + 'resolve' => function() { |
|
25 | 25 | return []; |
26 | 26 | } |
27 | 27 | ]) |
@@ -226,10 +226,10 @@ |
||
226 | 226 | |
227 | 227 | $value = substr($this->source, $start, $this->pos - $start); |
228 | 228 | |
229 | - if(strpos($value, '.') === false){ |
|
230 | - $value = (int) $value; |
|
229 | + if (strpos($value, '.') === false) { |
|
230 | + $value = (int)$value; |
|
231 | 231 | } else { |
232 | - $value = (float) $value; |
|
232 | + $value = (float)$value; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | return new Token(Token::TYPE_NUMBER, $value); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @return Field[]|Query[] |
|
64 | + * @return Query[] |
|
65 | 65 | */ |
66 | 66 | public function getFields() |
67 | 67 | { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @return Field[]|Query[] |
|
64 | + * @return Query[] |
|
65 | 65 | */ |
66 | 66 | public function getFields() |
67 | 67 | { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | /** |
190 | 190 | * @param $objectType InputObjectType|ObjectType |
191 | 191 | * @param $query Mutation|Query |
192 | - * @return null |
|
192 | + * @return boolean |
|
193 | 193 | */ |
194 | 194 | private function checkFieldExist($objectType, $query) |
195 | 195 | { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | - * @param $field Field |
|
229 | + * @param Field $field Field |
|
230 | 230 | * @param $contextValue mixed |
231 | 231 | * @param $query Query |
232 | 232 | * |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $preResolvedValue = $this->getPreResolvedValue($contextValue, $query); |
154 | 154 | |
155 | 155 | if ($field->getConfig()->getType()->getKind() == TypeMap::KIND_LIST) { |
156 | - if(!is_array($preResolvedValue)){ |
|
156 | + if (!is_array($preResolvedValue)) { |
|
157 | 157 | $value = null; |
158 | 158 | $this->resolveValidator->addError(new ResolveException('Not valid resolve value for list type')); |
159 | 159 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | if ($type->getKind() == TypeMap::KIND_ENUM) { |
168 | 168 | /** @var $type AbstractEnumType */ |
169 | - if(!$type->isValidValue($resolvedValueItem)) { |
|
169 | + if (!$type->isValidValue($resolvedValueItem)) { |
|
170 | 170 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
171 | 171 | |
172 | 172 | $listValue = null; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $value = $listValue; |
184 | 184 | } else { |
185 | 185 | if ($field->getType()->getKind() == TypeMap::KIND_ENUM) { |
186 | - if(!$field->getType()->isValidValue($preResolvedValue)) { |
|
186 | + if (!$field->getType()->isValidValue($preResolvedValue)) { |
|
187 | 187 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
188 | 188 | $value = null; |
189 | 189 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $value[] = []; |
215 | 215 | $index = count($value) - 1; |
216 | 216 | |
217 | - if(in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE]) ) { |
|
217 | + if (in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
218 | 218 | $type = $field->getConfig()->getType()->getConfig()->getItemConfig()->resolveType($resolvedValueItem); |
219 | 219 | } else { |
220 | 220 | $type = $field->getType(); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | { |
284 | 284 | $resolvedValue = $field->getConfig()->resolve($contextValue, $this->parseArgumentsValues($field, $query)); |
285 | 285 | |
286 | - if(in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])){ |
|
286 | + if (in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
287 | 287 | $resolvedType = $field->getType()->resolveType($resolvedValue); |
288 | 288 | $field->setType($resolvedType); |
289 | 289 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | return []; |
304 | 304 | } |
305 | 305 | |
306 | - $args = []; |
|
306 | + $args = []; |
|
307 | 307 | foreach ($query->getArguments() as $argument) { |
308 | 308 | $args[$argument->getName()] = $field->getConfig()->getArgument($argument->getName())->getType()->parseValue($argument->getValue()->getValue()); |
309 | 309 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | foreach ($fragment->getFields() as $fragmentField) { |
337 | 337 | $value = $this->collectValue($value, $this->executeQuery($fragmentField, $queryType, $resolvedValue)); |
338 | 338 | } |
339 | - } else if($field->getName() == self::TYPE_NAME_QUERY) { |
|
339 | + } else if ($field->getName() == self::TYPE_NAME_QUERY) { |
|
340 | 340 | $value = $this->collectValue($value, [$field->getAlias() ?: $field->getName() => $queryType->getName()]); |
341 | 341 | } else { |
342 | 342 | $value = $this->collectValue($value, $this->executeQuery($field, $queryType, $resolvedValue)); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function addFields($fieldsArray) |
42 | 42 | { |
43 | - foreach($fieldsArray as $fieldName => $fieldConfig) { |
|
43 | + foreach ($fieldsArray as $fieldName => $fieldConfig) { |
|
44 | 44 | if (is_object($fieldConfig)) { |
45 | 45 | $this->addField($fieldName, $fieldConfig); |
46 | 46 | } else { |
@@ -38,7 +38,7 @@ |
||
38 | 38 | { |
39 | 39 | $callable = $this->get('resolveType'); |
40 | 40 | |
41 | - if($callable && is_callable($callable)) { |
|
41 | + if ($callable && is_callable($callable)) { |
|
42 | 42 | return call_user_func_array($callable, [$object]); |
43 | 43 | } |
44 | 44 |