@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct(array $config) |
| 37 | 37 | { |
| 38 | - if (! isset($config['name'])) { |
|
| 38 | + if (!isset($config['name'])) { |
|
| 39 | 39 | $config['name'] = $this->tryInferName(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function isPossibleType(Type $type) : bool |
| 57 | 57 | { |
| 58 | - if (! $type instanceof ObjectType) { |
|
| 58 | + if (!$type instanceof ObjectType) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function getTypes() |
| 76 | 76 | { |
| 77 | 77 | if ($this->types === null) { |
| 78 | - if (! isset($this->config['types'])) { |
|
| 78 | + if (!isset($this->config['types'])) { |
|
| 79 | 79 | $types = null; |
| 80 | 80 | } elseif (is_callable($this->config['types'])) { |
| 81 | 81 | $types = call_user_func($this->config['types']); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $types = $this->config['types']; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! is_array($types)) { |
|
| 86 | + if (!is_array($types)) { |
|
| 87 | 87 | throw new InvariantViolation( |
| 88 | 88 | sprintf( |
| 89 | 89 | 'Must provide Array of types or a callable which returns such an array for Union %s', |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $this->types = array_map(static function ($type) { |
|
| 95 | + $this->types = array_map(static function($type) { |
|
| 96 | 96 | return Schema::resolveType($type); |
| 97 | 97 | }, $types); |
| 98 | 98 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | parent::assertValid(); |
| 128 | 128 | |
| 129 | - if (! isset($this->config['resolveType'])) { |
|
| 129 | + if (!isset($this->config['resolveType'])) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | Utils::getVariableType($config) |
| 109 | 109 | ); |
| 110 | 110 | Utils::invariant( |
| 111 | - ! $config->types || is_array($config->types) || is_callable($config->types), |
|
| 111 | + !$config->types || is_array($config->types) || is_callable($config->types), |
|
| 112 | 112 | '"types" must be array or callable if provided but got: ' . Utils::getVariableType($config->types) |
| 113 | 113 | ); |
| 114 | 114 | Utils::invariant( |
| 115 | - ! $config->directives || is_array($config->directives), |
|
| 115 | + !$config->directives || is_array($config->directives), |
|
| 116 | 116 | '"directives" must be Array if provided but got: ' . Utils::getVariableType($config->directives) |
| 117 | 117 | ); |
| 118 | 118 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $types = $types(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if (! is_array($types) && ! $types instanceof Traversable) { |
|
| 167 | + if (!is_array($types) && !$types instanceof Traversable) { |
|
| 168 | 168 | throw new InvariantViolation(sprintf( |
| 169 | 169 | 'Schema types callable must return array or instance of Traversable but got: %s', |
| 170 | 170 | Utils::getVariableType($types) |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | foreach ($types as $index => $type) { |
| 175 | 175 | $type = self::resolveType($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,10 +314,10 @@ 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 | 319 | |
| 320 | - if (! $type) { |
|
| 320 | + if (!$type) { |
|
| 321 | 321 | return null; |
| 322 | 322 | } |
| 323 | 323 | $this->resolvedTypes[$name] = self::resolveType($type); |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | { |
| 336 | 336 | $typeLoader = $this->config->typeLoader; |
| 337 | 337 | |
| 338 | - if (! $typeLoader) { |
|
| 338 | + if (!$typeLoader) { |
|
| 339 | 339 | return $this->defaultTypeLoader($typeName); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $type = $typeLoader($typeName); |
| 343 | 343 | |
| 344 | - if (! $type instanceof Type && ! is_callable($type)) { |
|
| 344 | + if (!$type instanceof Type && !is_callable($type)) { |
|
| 345 | 345 | throw new InvariantViolation( |
| 346 | 346 | sprintf( |
| 347 | 347 | 'Type loader is expected to return a callable or valid type "%s", but it returned %s', |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | foreach ($this->getTypeMap() as $type) { |
| 415 | 415 | if ($type instanceof ObjectType) { |
| 416 | 416 | foreach ($type->getInterfaces() as $interface) { |
| 417 | - if (! ($interface instanceof InterfaceType)) { |
|
| 417 | + if (!($interface instanceof InterfaceType)) { |
|
| 418 | 418 | continue; |
| 419 | 419 | } |
| 420 | 420 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $type->assertValid(); |
| 501 | 501 | |
| 502 | 502 | // Make sure type loader returns the same instance as registered in other places of schema |
| 503 | - if (! $this->config->typeLoader) { |
|
| 503 | + if (!$this->config->typeLoader) { |
|
| 504 | 504 | continue; |
| 505 | 505 | } |
| 506 | 506 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | if (Type::isCompositeType($initialType)) { |
| 95 | 95 | $this->parentTypeStack[] = $initialType; |
| 96 | 96 | } |
| 97 | - if (! Type::isOutputType($initialType)) { |
|
| 97 | + if (!Type::isOutputType($initialType)) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public static function extractTypes($type, ?array $typeMap = null) |
| 151 | 151 | { |
| 152 | - if (! $typeMap) { |
|
| 152 | + if (!$typeMap) { |
|
| 153 | 153 | $typeMap = []; |
| 154 | 154 | } |
| 155 | - if (! $type) { |
|
| 155 | + if (!$type) { |
|
| 156 | 156 | return $typeMap; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (! $type instanceof Type) { |
|
| 163 | + if (!$type instanceof Type) { |
|
| 164 | 164 | // Preserve these invalid types in map (at numeric index) to make them |
| 165 | 165 | // detectable during $schema->validate() |
| 166 | 166 | $i = 0; |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | $alreadyInMap = $alreadyInMap || $typeMap[$i] === $type; |
| 170 | 170 | $i++; |
| 171 | 171 | } |
| 172 | - if (! $alreadyInMap) { |
|
| 172 | + if (!$alreadyInMap) { |
|
| 173 | 173 | $typeMap[$i] = $type; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | return $typeMap; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (! empty($typeMap[$type->name])) { |
|
| 179 | + if (!empty($typeMap[$type->name])) { |
|
| 180 | 180 | Utils::invariant( |
| 181 | 181 | $typeMap[$type->name] === $type, |
| 182 | 182 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
| 199 | 199 | foreach ($type->getFields() as $fieldName => $field) { |
| 200 | - if (! empty($field->args)) { |
|
| 200 | + if (!empty($field->args)) { |
|
| 201 | 201 | $fieldArgTypes = array_map( |
| 202 | - static function (FieldArgument $arg) { |
|
| 202 | + static function(FieldArgument $arg) { |
|
| 203 | 203 | return $arg->getType(); |
| 204 | 204 | }, |
| 205 | 205 | $field->args |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | /** @var FieldArgument $argDef */ |
| 325 | 325 | $argDef = Utils::find( |
| 326 | 326 | $fieldOrDirective->args, |
| 327 | - static function ($arg) use ($node) { |
|
| 327 | + static function($arg) use ($node) { |
|
| 328 | 328 | return $arg->name === $node->name->value; |
| 329 | 329 | } |
| 330 | 330 | ); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return $type; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public static function byTypeName($shortName, $removeType=true) |
|
| 70 | + public static function byTypeName($shortName, $removeType = true) |
|
| 71 | 71 | { |
| 72 | 72 | $cacheName = strtolower($shortName); |
| 73 | 73 | $type = null; |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $method = lcfirst($shortName); |
| 80 | - if(method_exists(get_called_class(), $method)) { |
|
| 80 | + if (method_exists(get_called_class(), $method)) { |
|
| 81 | 81 | $type = self::{$method}(); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(!$type) { |
|
| 84 | + if (!$type) { |
|
| 85 | 85 | throw new Exception("Unknown graphql type: " . $shortName); |
| 86 | 86 | } |
| 87 | 87 | return $type; |