@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | Utils::getVariableType($config) |
| 110 | 110 | ); |
| 111 | 111 | Utils::invariant( |
| 112 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
| 112 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
| 113 | 113 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
| 114 | 114 | ); |
| 115 | 115 | Utils::invariant( |
| 116 | - ! $config->directives || is_array($config->directives), |
|
| 116 | + !$config->directives || is_array($config->directives), |
|
| 117 | 117 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
| 118 | 118 | ); |
| 119 | 119 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $types = $types(); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if (! is_array($types) && ! $types instanceof Traversable) { |
|
| 168 | + if (!is_array($types) && !$types instanceof Traversable) { |
|
| 169 | 169 | throw new InvariantViolation(sprintf( |
| 170 | 170 | 'Schema types callable must return array or instance of Traversable but got: %s', |
| 171 | 171 | Utils::getVariableType($types) |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | foreach ($types as $index => $type) { |
| 176 | - if (! $type instanceof Type) { |
|
| 176 | + if (!$type instanceof Type) { |
|
| 177 | 177 | throw new InvariantViolation(sprintf( |
| 178 | 178 | 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', |
| 179 | 179 | $index, |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function getTypeMap() |
| 198 | 198 | { |
| 199 | - if (! $this->fullyLoaded) { |
|
| 199 | + if (!$this->fullyLoaded) { |
|
| 200 | 200 | $this->resolvedTypes = $this->collectAllTypes(); |
| 201 | 201 | $this->fullyLoaded = true; |
| 202 | 202 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $typeMap = TypeInfo::extractTypes($type, $typeMap); |
| 215 | 215 | } |
| 216 | 216 | foreach ($this->getDirectives() as $directive) { |
| 217 | - if (! ($directive instanceof Directive)) { |
|
| 217 | + if (!($directive instanceof Directive)) { |
|
| 218 | 218 | continue; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -314,9 +314,9 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function getType(string $name) : ?Type |
| 316 | 316 | { |
| 317 | - if (! isset($this->resolvedTypes[$name])) { |
|
| 317 | + if (!isset($this->resolvedTypes[$name])) { |
|
| 318 | 318 | $type = $this->loadType($name); |
| 319 | - if (! $type) { |
|
| 319 | + if (!$type) { |
|
| 320 | 320 | return null; |
| 321 | 321 | } |
| 322 | 322 | $this->resolvedTypes[$name] = $type; |
@@ -334,13 +334,13 @@ discard block |
||
| 334 | 334 | { |
| 335 | 335 | $typeLoader = $this->config->typeLoader; |
| 336 | 336 | |
| 337 | - if (! $typeLoader) { |
|
| 337 | + if (!$typeLoader) { |
|
| 338 | 338 | return $this->defaultTypeLoader($typeName); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $type = $typeLoader($typeName); |
| 342 | 342 | |
| 343 | - if (! $type instanceof Type) { |
|
| 343 | + if (!$type instanceof Type) { |
|
| 344 | 344 | throw new InvariantViolation( |
| 345 | 345 | sprintf( |
| 346 | 346 | 'Type loader is expected to return valid type "%s", but it returned %s', |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | foreach ($this->getTypeMap() as $type) { |
| 396 | 396 | if ($type instanceof ObjectType) { |
| 397 | 397 | foreach ($type->getInterfaces() as $interface) { |
| 398 | - if (! ($interface instanceof InterfaceType)) { |
|
| 398 | + if (!($interface instanceof InterfaceType)) { |
|
| 399 | 399 | continue; |
| 400 | 400 | } |
| 401 | 401 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | $type->assertValid(); |
| 482 | 482 | |
| 483 | 483 | // Make sure type loader returns the same instance as registered in other places of schema |
| 484 | - if (! $this->config->typeLoader) { |
|
| 484 | + if (!$this->config->typeLoader) { |
|
| 485 | 485 | continue; |
| 486 | 486 | } |
| 487 | 487 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | { |
| 78 | 78 | $isInt = is_int($value) || (is_float($value) && floor($value) === $value); |
| 79 | 79 | |
| 80 | - if (! $isInt) { |
|
| 80 | + if (!$isInt) { |
|
| 81 | 81 | throw new Error( |
| 82 | 82 | 'Int cannot represent non-integer value: ' . |
| 83 | 83 | Utils::printSafe($value) |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function __construct(array $config) |
| 35 | 35 | { |
| 36 | - if (! isset($config['name'])) { |
|
| 36 | + if (!isset($config['name'])) { |
|
| 37 | 37 | $config['name'] = $this->tryInferName(); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function isPossibleType(Type $type) : bool |
| 55 | 55 | { |
| 56 | - if (! $type instanceof ObjectType) { |
|
| 56 | + if (!$type instanceof ObjectType) { |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function getTypes() |
| 74 | 74 | { |
| 75 | 75 | if ($this->types === null) { |
| 76 | - if (! isset($this->config['types'])) { |
|
| 76 | + if (!isset($this->config['types'])) { |
|
| 77 | 77 | $types = null; |
| 78 | 78 | } elseif (is_callable($this->config['types'])) { |
| 79 | 79 | $types = call_user_func($this->config['types']); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $types = $this->config['types']; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (! is_array($types)) { |
|
| 84 | + if (!is_array($types)) { |
|
| 85 | 85 | throw new InvariantViolation( |
| 86 | 86 | sprintf( |
| 87 | 87 | 'Must provide Array of types or a callable which returns such an array for Union %s', |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | parent::assertValid(); |
| 124 | 124 | |
| 125 | - if (! isset($this->config['resolveType'])) { |
|
| 125 | + if (!isset($this->config['resolveType'])) { |
|
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $float = is_numeric($value) || is_bool($value) ? floatval($value) : null; |
| 39 | 39 | |
| 40 | - if ($float === null || ! is_finite($float)) { |
|
| 40 | + if ($float === null || !is_finite($float)) { |
|
| 41 | 41 | throw new Error( |
| 42 | 42 | 'Float cannot represent non numeric value: ' . |
| 43 | 43 | Utils::printSafe($value) |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $float = is_float($value) || is_int($value) ? floatval($value) : null; |
| 58 | 58 | |
| 59 | - if ($float === null || ! is_finite($float)) { |
|
| 59 | + if ($float === null || !is_finite($float)) { |
|
| 60 | 60 | throw new Error( |
| 61 | 61 | 'Float cannot represent non numeric value: ' . |
| 62 | 62 | Utils::printSafe($value) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | || (is_object($value) && method_exists($value, '__toString')) |
| 39 | 39 | || $value === null; |
| 40 | 40 | |
| 41 | - if (! $canCast) { |
|
| 41 | + if (!$canCast) { |
|
| 42 | 42 | throw new Error( |
| 43 | 43 | 'String cannot represent value: ' . Utils::printSafe($value) |
| 44 | 44 | ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function parseValue($value) |
| 58 | 58 | { |
| 59 | - if (! is_string($value)) { |
|
| 59 | + if (!is_string($value)) { |
|
| 60 | 60 | throw new Error( |
| 61 | 61 | 'String cannot represent a non string value: ' . Utils::printSafe($value) |
| 62 | 62 | ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function __construct(array $config) |
| 81 | 81 | { |
| 82 | - if (! isset($config['name'])) { |
|
| 82 | + if (!isset($config['name'])) { |
|
| 83 | 83 | $config['name'] = $this->tryInferName(); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | ? call_user_func($interfaces) |
| 190 | 190 | : $interfaces; |
| 191 | 191 | |
| 192 | - if ($interfaces !== null && ! is_array($interfaces)) { |
|
| 192 | + if ($interfaces !== null && !is_array($interfaces)) { |
|
| 193 | 193 | throw new InvariantViolation( |
| 194 | 194 | sprintf('%s interfaces must be an Array or a callable which returns an Array.', $this->name) |
| 195 | 195 | ); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function __construct($config) |
| 44 | 44 | { |
| 45 | - if (! isset($config['name'])) { |
|
| 45 | + if (!isset($config['name'])) { |
|
| 46 | 46 | $config['name'] = $this->tryInferName(); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $lookup = $this->getNameLookup(); |
| 66 | 66 | |
| 67 | - if (! is_string($name)) { |
|
| 67 | + if (!is_string($name)) { |
|
| 68 | 68 | return null; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | private function getNameLookup() : ArrayObject |
| 75 | 75 | { |
| 76 | - if (! $this->nameLookup) { |
|
| 76 | + if (!$this->nameLookup) { |
|
| 77 | 77 | /** @var ArrayObject<string, EnumValueDefinition> $lookup */ |
| 78 | 78 | $lookup = new ArrayObject(); |
| 79 | 79 | foreach ($this->getValues() as $value) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $config = $this->config; |
| 96 | 96 | |
| 97 | 97 | if (isset($config['values'])) { |
| 98 | - if (! is_array($config['values'])) { |
|
| 98 | + if (!is_array($config['values'])) { |
|
| 99 | 99 | throw new InvariantViolation(sprintf('%s values must be an array', $this->name)); |
| 100 | 100 | } |
| 101 | 101 | foreach ($config['values'] as $name => $value) { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $values = $this->getValues(); |
| 212 | 212 | foreach ($values as $value) { |
| 213 | 213 | Utils::invariant( |
| 214 | - ! isset($value->config['isDeprecated']), |
|
| 214 | + !isset($value->config['isDeprecated']), |
|
| 215 | 215 | sprintf( |
| 216 | 216 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
| 217 | 217 | $this->name, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function hasType(string $type) : bool |
| 81 | 81 | { |
| 82 | - return count(array_filter($this->getReferencedTypes(), static function (string $referencedType) use ($type) { |
|
| 82 | + return count(array_filter($this->getReferencedTypes(), static function(string $referencedType) use ($type) { |
|
| 83 | 83 | return $type === $referencedType; |
| 84 | 84 | })) > 0; |
| 85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function hasField(string $field) : bool |
| 96 | 96 | { |
| 97 | - return count(array_filter($this->getReferencedFields(), static function (string $referencedField) use ($field) { |
|
| 97 | + return count(array_filter($this->getReferencedFields(), static function(string $referencedField) use ($field) { |
|
| 98 | 98 | return $field === $referencedField; |
| 99 | 99 | })) > 0; |
| 100 | 100 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function subFields(string $typename) : array |
| 106 | 106 | { |
| 107 | - if (! array_key_exists($typename, $this->types)) { |
|
| 107 | + if (!array_key_exists($typename, $this->types)) { |
|
| 108 | 108 | return []; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $implementors = []; |
| 121 | 121 | /** @var FieldNode $fieldNode */ |
| 122 | 122 | foreach ($fieldNodes as $fieldNode) { |
| 123 | - if (! $fieldNode->selectionSet) { |
|
| 123 | + if (!$fieldNode->selectionSet) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | private function mergeFields(Type $parentType, Type $type, array $fields, array $subfields, array &$implementors) : array |
| 230 | 230 | { |
| 231 | - if ($this->groupImplementorFields && $parentType instanceof AbstractType && ! $type instanceof AbstractType) { |
|
| 231 | + if ($this->groupImplementorFields && $parentType instanceof AbstractType && !$type instanceof AbstractType) { |
|
| 232 | 232 | $implementors[$type->name] = [ |
| 233 | 233 | 'type' => $type, |
| 234 | 234 | 'fields' => $this->arrayMergeDeep( |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | foreach ($array2 as $key => & $value) { |
| 270 | 270 | if (is_numeric($key)) { |
| 271 | - if (! in_array($value, $merged, true)) { |
|
| 271 | + if (!in_array($value, $merged, true)) { |
|
| 272 | 272 | $merged[] = $value; |
| 273 | 273 | } |
| 274 | 274 | } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | || is_int($value) |
| 42 | 42 | || (is_object($value) && method_exists($value, '__toString')); |
| 43 | 43 | |
| 44 | - if (! $canCast) { |
|
| 44 | + if (!$canCast) { |
|
| 45 | 45 | throw new Error('ID cannot represent value: ' . Utils::printSafe($value)); |
| 46 | 46 | } |
| 47 | 47 | |