@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->parentTypeStack = []; |
| 75 | 75 | $this->inputTypeStack = []; |
| 76 | 76 | $this->fieldDefStack = []; |
| 77 | - if (! $initialType) { |
|
| 77 | + if (!$initialType) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if (Type::isCompositeType($initialType)) { |
| 85 | 85 | $this->parentTypeStack[] = $initialType; |
| 86 | 86 | } |
| 87 | - if (! Type::isOutputType($initialType)) { |
|
| 87 | + if (!Type::isOutputType($initialType)) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public static function extractTypes($type, ?array $typeMap = null) |
| 134 | 134 | { |
| 135 | - if (! $typeMap) { |
|
| 135 | + if (!$typeMap) { |
|
| 136 | 136 | $typeMap = []; |
| 137 | 137 | } |
| 138 | - if (! $type) { |
|
| 138 | + if (!$type) { |
|
| 139 | 139 | return $typeMap; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if ($type instanceof WrappingType) { |
| 143 | 143 | return self::extractTypes($type->getWrappedType(true), $typeMap); |
| 144 | 144 | } |
| 145 | - if (! $type instanceof Type) { |
|
| 145 | + if (!$type instanceof Type) { |
|
| 146 | 146 | Warning::warnOnce( |
| 147 | 147 | 'One of the schema types is not a valid type definition instance. ' . |
| 148 | 148 | 'Try running $schema->assertValid() to find out the cause of this warning.', |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | return $typeMap; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (! empty($typeMap[$type->name])) { |
|
| 155 | + if (!empty($typeMap[$type->name])) { |
|
| 156 | 156 | Utils::invariant( |
| 157 | 157 | $typeMap[$type->name] === $type, |
| 158 | 158 | sprintf('Schema must contain unique named types but contains multiple types named "%s" ', $type) . |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | if ($type instanceof ObjectType || $type instanceof InterfaceType) { |
| 175 | 175 | foreach ((array) $type->getFields() as $fieldName => $field) { |
| 176 | - if (! empty($field->args)) { |
|
| 176 | + if (!empty($field->args)) { |
|
| 177 | 177 | $fieldArgTypes = array_map( |
| 178 | - function (FieldArgument $arg) { |
|
| 178 | + function(FieldArgument $arg) { |
|
| 179 | 179 | return $arg->getType(); |
| 180 | 180 | }, |
| 181 | 181 | $field->args |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | if ($fieldOrDirective) { |
| 305 | 305 | $argDef = Utils::find( |
| 306 | 306 | $fieldOrDirective->args, |
| 307 | - function ($arg) use ($node) { |
|
| 307 | + function($arg) use ($node) { |
|
| 308 | 308 | return $arg->name === $node->name->value; |
| 309 | 309 | } |
| 310 | 310 | ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public function getType() |
| 354 | 354 | { |
| 355 | - if (! empty($this->typeStack)) { |
|
| 355 | + if (!empty($this->typeStack)) { |
|
| 356 | 356 | return $this->typeStack[count($this->typeStack) - 1]; |
| 357 | 357 | } |
| 358 | 358 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public function getParentType() |
| 366 | 366 | { |
| 367 | - if (! empty($this->parentTypeStack)) { |
|
| 367 | + if (!empty($this->parentTypeStack)) { |
|
| 368 | 368 | return $this->parentTypeStack[count($this->parentTypeStack) - 1]; |
| 369 | 369 | } |
| 370 | 370 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function getFieldDef() |
| 429 | 429 | { |
| 430 | - if (! empty($this->fieldDefStack)) { |
|
| 430 | + if (!empty($this->fieldDefStack)) { |
|
| 431 | 431 | return $this->fieldDefStack[count($this->fieldDefStack) - 1]; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | public function getInputType() |
| 441 | 441 | { |
| 442 | - if (! empty($this->inputTypeStack)) { |
|
| 442 | + if (!empty($this->inputTypeStack)) { |
|
| 443 | 443 | return $this->inputTypeStack[count($this->inputTypeStack) - 1]; |
| 444 | 444 | } |
| 445 | 445 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | case NodeKind::UNION_TYPE_DEFINITION: |
| 112 | 112 | case NodeKind::INPUT_OBJECT_TYPE_DEFINITION: |
| 113 | 113 | $typeName = $d->name->value; |
| 114 | - if (! empty($this->nodeMap[$typeName])) { |
|
| 114 | + if (!empty($this->nodeMap[$typeName])) { |
|
| 115 | 115 | throw new Error(sprintf('Type "%s" was defined more than once.', $typeName)); |
| 116 | 116 | } |
| 117 | 117 | $typeDefs[] = $d; |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | $defintionBuilder = new ASTDefinitionBuilder( |
| 135 | 135 | $this->nodeMap, |
| 136 | 136 | $this->options, |
| 137 | - function ($typeName) { |
|
| 137 | + function($typeName) { |
|
| 138 | 138 | throw new Error('Type "' . $typeName . '" not found in document.'); |
| 139 | 139 | }, |
| 140 | 140 | $this->typeConfigDecorator |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | $directives = array_map( |
| 144 | - function ($def) use ($defintionBuilder) { |
|
| 144 | + function($def) use ($defintionBuilder) { |
|
| 145 | 145 | return $defintionBuilder->buildDirective($def); |
| 146 | 146 | }, |
| 147 | 147 | $directiveDefs |
@@ -150,31 +150,31 @@ discard block |
||
| 150 | 150 | // If specified directives were not explicitly declared, add them. |
| 151 | 151 | $skip = array_reduce( |
| 152 | 152 | $directives, |
| 153 | - function ($hasSkip, $directive) { |
|
| 153 | + function($hasSkip, $directive) { |
|
| 154 | 154 | return $hasSkip || $directive->name === 'skip'; |
| 155 | 155 | } |
| 156 | 156 | ); |
| 157 | - if (! $skip) { |
|
| 157 | + if (!$skip) { |
|
| 158 | 158 | $directives[] = Directive::skipDirective(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $include = array_reduce( |
| 162 | 162 | $directives, |
| 163 | - function ($hasInclude, $directive) { |
|
| 163 | + function($hasInclude, $directive) { |
|
| 164 | 164 | return $hasInclude || $directive->name === 'include'; |
| 165 | 165 | } |
| 166 | 166 | ); |
| 167 | - if (! $include) { |
|
| 167 | + if (!$include) { |
|
| 168 | 168 | $directives[] = Directive::includeDirective(); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $deprecated = array_reduce( |
| 172 | 172 | $directives, |
| 173 | - function ($hasDeprecated, $directive) { |
|
| 173 | + function($hasDeprecated, $directive) { |
|
| 174 | 174 | return $hasDeprecated || $directive->name === 'deprecated'; |
| 175 | 175 | } |
| 176 | 176 | ); |
| 177 | - if (! $deprecated) { |
|
| 177 | + if (!$deprecated) { |
|
| 178 | 178 | $directives[] = Directive::deprecatedDirective(); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | 'subscription' => isset($operationTypes['subscription']) |
| 193 | 193 | ? $defintionBuilder->buildType($operationTypes['subscription']) |
| 194 | 194 | : null, |
| 195 | - 'typeLoader' => function ($name) use ($defintionBuilder) { |
|
| 195 | + 'typeLoader' => function($name) use ($defintionBuilder) { |
|
| 196 | 196 | return $defintionBuilder->buildType($name); |
| 197 | 197 | }, |
| 198 | 198 | 'directives' => $directives, |
| 199 | 199 | 'astNode' => $schemaDef, |
| 200 | - 'types' => function () use ($defintionBuilder) { |
|
| 200 | + 'types' => function() use ($defintionBuilder) { |
|
| 201 | 201 | $types = []; |
| 202 | 202 | foreach ($this->nodeMap as $name => $def) { |
| 203 | 203 | $types[] = $defintionBuilder->buildType($def->name->value); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | throw new Error(sprintf('Must provide only one %s type in schema.', $operation)); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - if (! isset($this->nodeMap[$typeName])) { |
|
| 230 | + if (!isset($this->nodeMap[$typeName])) { |
|
| 231 | 231 | throw new Error(sprintf('Specified %s type "%s" not found in document.', $operation, $typeName)); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $usages = $this->recursiveVariableUsages[$operation] ?? null; |
| 100 | 100 | |
| 101 | - if (! $usages) { |
|
| 101 | + if (!$usages) { |
|
| 102 | 102 | $usages = $this->getVariableUsages($operation); |
| 103 | 103 | $fragments = $this->getRecursivelyReferencedFragments($operation); |
| 104 | 104 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $usages = $this->variableUsages[$node] ?? null; |
| 122 | 122 | |
| 123 | - if (! $usages) { |
|
| 123 | + if (!$usages) { |
|
| 124 | 124 | $newUsages = []; |
| 125 | 125 | $typeInfo = new TypeInfo($this->schema); |
| 126 | 126 | Visitor::visit( |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | Visitor::visitWithTypeInfo( |
| 129 | 129 | $typeInfo, |
| 130 | 130 | [ |
| 131 | - NodeKind::VARIABLE_DEFINITION => function () { |
|
| 131 | + NodeKind::VARIABLE_DEFINITION => function() { |
|
| 132 | 132 | return false; |
| 133 | 133 | }, |
| 134 | - NodeKind::VARIABLE => function (VariableNode $variable) use ( |
|
| 134 | + NodeKind::VARIABLE => function(VariableNode $variable) use ( |
|
| 135 | 135 | &$newUsages, |
| 136 | 136 | $typeInfo |
| 137 | 137 | ) { |
@@ -154,23 +154,23 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $fragments = $this->recursivelyReferencedFragments[$operation] ?? null; |
| 156 | 156 | |
| 157 | - if (! $fragments) { |
|
| 157 | + if (!$fragments) { |
|
| 158 | 158 | $fragments = []; |
| 159 | 159 | $collectedNames = []; |
| 160 | 160 | $nodesToVisit = [$operation]; |
| 161 | - while (! empty($nodesToVisit)) { |
|
| 161 | + while (!empty($nodesToVisit)) { |
|
| 162 | 162 | $node = array_pop($nodesToVisit); |
| 163 | 163 | $spreads = $this->getFragmentSpreads($node); |
| 164 | 164 | for ($i = 0; $i < count($spreads); $i++) { |
| 165 | 165 | $fragName = $spreads[$i]->name->value; |
| 166 | 166 | |
| 167 | - if (! empty($collectedNames[$fragName])) { |
|
| 167 | + if (!empty($collectedNames[$fragName])) { |
|
| 168 | 168 | continue; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $collectedNames[$fragName] = true; |
| 172 | 172 | $fragment = $this->getFragment($fragName); |
| 173 | - if (! $fragment) { |
|
| 173 | + if (!$fragment) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | public function getFragmentSpreads(HasSelectionSet $node) |
| 191 | 191 | { |
| 192 | 192 | $spreads = $this->fragmentSpreads[$node] ?? null; |
| 193 | - if (! $spreads) { |
|
| 193 | + if (!$spreads) { |
|
| 194 | 194 | $spreads = []; |
| 195 | 195 | /** @var SelectionSetNode[] $setsToVisit */ |
| 196 | 196 | $setsToVisit = [$node->selectionSet]; |
| 197 | - while (! empty($setsToVisit)) { |
|
| 197 | + while (!empty($setsToVisit)) { |
|
| 198 | 198 | $set = array_pop($setsToVisit); |
| 199 | 199 | |
| 200 | 200 | for ($i = 0; $i < count($set->selections); $i++) { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function getFragment($name) |
| 220 | 220 | { |
| 221 | 221 | $fragments = $this->fragments; |
| 222 | - if (! $fragments) { |
|
| 222 | + if (!$fragments) { |
|
| 223 | 223 | $fragments = []; |
| 224 | 224 | foreach ($this->getDocument()->definitions as $statement) { |
| 225 | 225 | if ($statement->kind !== NodeKind::FRAGMENT_DEFINITION) { |
@@ -48,6 +48,6 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function isDeprecated() |
| 50 | 50 | { |
| 51 | - return ! ! $this->deprecationReason; |
|
| 51 | + return !!$this->deprecationReason; |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | |
| 165 | 165 | foreach ($selectionSet->selections as $selectionNode) { |
| 166 | 166 | if ($selectionNode instanceof FieldNode) { |
| 167 | - $fields[$selectionNode->name->value] = $descend > 0 && ! empty($selectionNode->selectionSet) |
|
| 167 | + $fields[$selectionNode->name->value] = $descend > 0 && !empty($selectionNode->selectionSet) |
|
| 168 | 168 | ? $this->foldSelectionSet($selectionNode->selectionSet, $descend - 1) |
| 169 | 169 | : true; |
| 170 | 170 | } elseif ($selectionNode instanceof FragmentSpreadNode) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | return $type instanceof InputType && |
| 176 | 176 | ( |
| 177 | - ! $type instanceof WrappingType || |
|
| 177 | + !$type instanceof WrappingType || |
|
| 178 | 178 | self::getNamedType($type) instanceof InputType |
| 179 | 179 | ); |
| 180 | 180 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | { |
| 206 | 206 | return $type instanceof OutputType && |
| 207 | 207 | ( |
| 208 | - ! $type instanceof WrappingType || |
|
| 208 | + !$type instanceof WrappingType || |
|
| 209 | 209 | self::getNamedType($type) instanceof OutputType |
| 210 | 210 | ); |
| 211 | 211 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function __construct($config) |
| 31 | 31 | { |
| 32 | - if (! isset($config['name'])) { |
|
| 32 | + if (!isset($config['name'])) { |
|
| 33 | 33 | $config['name'] = $this->tryInferName(); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function isPossibleType(Type $type) |
| 53 | 53 | { |
| 54 | - if (! $type instanceof ObjectType) { |
|
| 54 | + if (!$type instanceof ObjectType) { |
|
| 55 | 55 | return false; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function getTypes() |
| 72 | 72 | { |
| 73 | 73 | if ($this->types === null) { |
| 74 | - if (! isset($this->config['types'])) { |
|
| 74 | + if (!isset($this->config['types'])) { |
|
| 75 | 75 | $types = null; |
| 76 | 76 | } elseif (is_callable($this->config['types'])) { |
| 77 | 77 | $types = call_user_func($this->config['types']); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $types = $this->config['types']; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (! is_array($types)) { |
|
| 82 | + if (!is_array($types)) { |
|
| 83 | 83 | throw new InvariantViolation( |
| 84 | 84 | sprintf( |
| 85 | 85 | 'Must provide Array of types or a callable which returns such an array for Union %s', |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | parent::assertValid(); |
| 121 | 121 | |
| 122 | - if (! isset($this->config['resolveType'])) { |
|
| 122 | + if (!isset($this->config['resolveType'])) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' . |
| 66 | 66 | 'functions are also provided.' |
| 67 | 67 | ); |
| 68 | - if (! isset($this->config['parseValue']) && ! isset($this->config['parseLiteral'])) { |
|
| 68 | + if (!isset($this->config['parseValue']) && !isset($this->config['parseLiteral'])) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function __construct($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 | $lookup = $this->getNameLookup(); |
| 57 | 57 | |
| 58 | - if (! is_string($name)) { |
|
| 58 | + if (!is_string($name)) { |
|
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | private function getNameLookup() |
| 69 | 69 | { |
| 70 | - if (! $this->nameLookup) { |
|
| 70 | + if (!$this->nameLookup) { |
|
| 71 | 71 | $lookup = new \ArrayObject(); |
| 72 | 72 | foreach ($this->getValues() as $value) { |
| 73 | 73 | $lookup[$value->name] = $value; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $config = $this->config; |
| 89 | 89 | |
| 90 | 90 | if (isset($config['values'])) { |
| 91 | - if (! is_array($config['values'])) { |
|
| 91 | + if (!is_array($config['values'])) { |
|
| 92 | 92 | throw new InvariantViolation(sprintf('%s values must be an array', $this->name)); |
| 93 | 93 | } |
| 94 | 94 | foreach ($config['values'] as $name => $value) { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $values = $this->getValues(); |
| 200 | 200 | foreach ($values as $value) { |
| 201 | 201 | Utils::invariant( |
| 202 | - ! isset($value->config['isDeprecated']), |
|
| 202 | + !isset($value->config['isDeprecated']), |
|
| 203 | 203 | sprintf( |
| 204 | 204 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
| 205 | 205 | $this->name, |