@@ -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 | * |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $preResolvedValue = $this->getPreResolvedValue($contextValue, $query); |
| 155 | 155 | |
| 156 | 156 | if ($field->getConfig()->getType()->getKind() == TypeMap::KIND_LIST) { |
| 157 | - if(!is_array($preResolvedValue)){ |
|
| 157 | + if (!is_array($preResolvedValue)) { |
|
| 158 | 158 | $value = null; |
| 159 | 159 | $this->resolveValidator->addError(new ResolveException('Not valid resolve value for list type')); |
| 160 | 160 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | if ($type->getKind() == TypeMap::KIND_ENUM) { |
| 169 | 169 | /** @var $type AbstractEnumType */ |
| 170 | - if(!$type->isValidValue($resolvedValueItem)) { |
|
| 170 | + if (!$type->isValidValue($resolvedValueItem)) { |
|
| 171 | 171 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
| 172 | 172 | |
| 173 | 173 | $listValue = null; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $value = $listValue; |
| 185 | 185 | } else { |
| 186 | 186 | if ($field->getType()->getKind() == TypeMap::KIND_ENUM) { |
| 187 | - if(!$field->getType()->isValidValue($preResolvedValue)) { |
|
| 187 | + if (!$field->getType()->isValidValue($preResolvedValue)) { |
|
| 188 | 188 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
| 189 | 189 | $value = null; |
| 190 | 190 | } else { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $value[] = []; |
| 216 | 216 | $index = count($value) - 1; |
| 217 | 217 | |
| 218 | - if(in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE]) ) { |
|
| 218 | + if (in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
| 219 | 219 | $type = $field->getConfig()->getType()->getConfig()->getItemConfig()->resolveType($resolvedValueItem); |
| 220 | 220 | } else { |
| 221 | 221 | $type = $field->getType(); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | $resolvedValue = $field->getConfig()->resolve($contextValue, $this->parseArgumentsValues($field, $query)); |
| 286 | 286 | |
| 287 | - if(in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])){ |
|
| 287 | + if (in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
| 288 | 288 | $resolvedType = $field->getType()->resolveType($resolvedValue); |
| 289 | 289 | $field->setType($resolvedType); |
| 290 | 290 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | return []; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - $args = []; |
|
| 307 | + $args = []; |
|
| 308 | 308 | foreach ($query->getArguments() as $argument) { |
| 309 | 309 | $args[$argument->getName()] = $field->getConfig()->getArgument($argument->getName())->getType()->parseValue($argument->getValue()->getValue()); |
| 310 | 310 | } |
@@ -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 | |