| @@ -72,12 +72,12 @@ discard block | ||
| 72 | 72 | $astDefinition = $context->getDocument()->definitions; | 
| 73 | 73 | |
| 74 | 74 |          foreach ($astDefinition as $def) { | 
| 75 | -            if (! ($def instanceof DirectiveDefinitionNode)) { | |
| 75 | +            if (!($def instanceof DirectiveDefinitionNode)) { | |
| 76 | 76 | continue; | 
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | 79 | $locationsMap[$def->name->value] = array_map( | 
| 80 | -                static function ($name) : string { | |
| 80 | +                static function($name) : string { | |
| 81 | 81 | return $name->value; | 
| 82 | 82 | }, | 
| 83 | 83 | $def->locations | 
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | return [ | 
| 88 | - NodeKind::DIRECTIVE => function ( | |
| 88 | + NodeKind::DIRECTIVE => function( | |
| 89 | 89 | DirectiveNode $node, | 
| 90 | 90 | $key, | 
| 91 | 91 | $parent, | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | $name = $node->name->value; | 
| 99 | 99 | $locations = $locationsMap[$name] ?? null; | 
| 100 | 100 | |
| 101 | -                if (! $locations) { | |
| 101 | +                if (!$locations) { | |
| 102 | 102 | $context->reportError(new Error( | 
| 103 | 103 | self::unknownDirectiveMessage($name), | 
| 104 | 104 | [$node] | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | |
| 110 | 110 | $candidateLocation = $this->getDirectiveLocationForASTPath($ancestors); | 
| 111 | 111 | |
| 112 | -                if (! $candidateLocation || in_array($candidateLocation, $locations, true)) { | |
| 112 | +                if (!$candidateLocation || in_array($candidateLocation, $locations, true)) { | |
| 113 | 113 | return; | 
| 114 | 114 | } | 
| 115 | 115 | $context->reportError( | 
| @@ -31,7 +31,7 @@ | ||
| 31 | 31 | return $this->invokeIfNeeded( | 
| 32 | 32 | $context, | 
| 33 | 33 | [ | 
| 34 | -                NodeKind::FIELD => static function (FieldNode $node) use ($context) : void { | |
| 34 | +                NodeKind::FIELD => static function(FieldNode $node) use ($context) : void { | |
| 35 | 35 |                      if ($node->name->value !== '__type' && $node->name->value !== '__schema') { | 
| 36 | 36 | return; | 
| 37 | 37 | } | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | // Compute list of blame nodes. | 
| 107 | 107 |          if ($nodes instanceof Traversable) { | 
| 108 | 108 | $nodes = iterator_to_array($nodes); | 
| 109 | -        } elseif ($nodes && ! is_array($nodes)) { | |
| 109 | +        } elseif ($nodes && !is_array($nodes)) { | |
| 110 | 110 | $nodes = [$nodes]; | 
| 111 | 111 | } | 
| 112 | 112 | |
| @@ -212,7 +212,7 @@ discard block | ||
| 212 | 212 | public function getSource() | 
| 213 | 213 |      { | 
| 214 | 214 |          if ($this->source === null) { | 
| 215 | -            if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { | |
| 215 | +            if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { | |
| 216 | 216 | $this->source = $this->nodes[0]->loc->source; | 
| 217 | 217 | } | 
| 218 | 218 | } | 
| @@ -225,9 +225,9 @@ discard block | ||
| 225 | 225 | */ | 
| 226 | 226 | public function getPositions() | 
| 227 | 227 |      { | 
| 228 | -        if ($this->positions === null && ! empty($this->nodes)) { | |
| 228 | +        if ($this->positions === null && !empty($this->nodes)) { | |
| 229 | 229 | $positions = array_map( | 
| 230 | -                static function ($node) : ?int { | |
| 230 | +                static function($node) : ?int { | |
| 231 | 231 | return isset($node->loc) ? $node->loc->start : null; | 
| 232 | 232 | }, | 
| 233 | 233 | $this->nodes | 
| @@ -235,7 +235,7 @@ discard block | ||
| 235 | 235 | |
| 236 | 236 | $positions = array_filter( | 
| 237 | 237 | $positions, | 
| 238 | -                static function ($p) : bool { | |
| 238 | +                static function($p) : bool { | |
| 239 | 239 | return $p !== null; | 
| 240 | 240 | } | 
| 241 | 241 | ); | 
| @@ -270,15 +270,15 @@ discard block | ||
| 270 | 270 | |
| 271 | 271 |              if ($positions && $source) { | 
| 272 | 272 | $this->locations = array_map( | 
| 273 | -                    static function ($pos) use ($source) : SourceLocation { | |
| 273 | +                    static function($pos) use ($source) : SourceLocation { | |
| 274 | 274 | return $source->getLocation($pos); | 
| 275 | 275 | }, | 
| 276 | 276 | $positions | 
| 277 | 277 | ); | 
| 278 | 278 |              } elseif ($nodes) { | 
| 279 | - $locations = array_filter( | |
| 279 | + $locations = array_filter( | |
| 280 | 280 | array_map( | 
| 281 | -                        static function ($node) { | |
| 281 | +                        static function($node) { | |
| 282 | 282 |                              if ($node->loc && $node->loc->source) { | 
| 283 | 283 | return $node->loc->source->getLocation($node->loc->start); | 
| 284 | 284 | } | 
| @@ -343,18 +343,18 @@ discard block | ||
| 343 | 343 | |
| 344 | 344 | $locations = Utils::map( | 
| 345 | 345 | $this->getLocations(), | 
| 346 | -            static function (SourceLocation $loc) : array { | |
| 346 | +            static function(SourceLocation $loc) : array { | |
| 347 | 347 | return $loc->toSerializableArray(); | 
| 348 | 348 | } | 
| 349 | 349 | ); | 
| 350 | 350 | |
| 351 | -        if (! empty($locations)) { | |
| 351 | +        if (!empty($locations)) { | |
| 352 | 352 | $arr['locations'] = $locations; | 
| 353 | 353 | } | 
| 354 | -        if (! empty($this->path)) { | |
| 354 | +        if (!empty($this->path)) { | |
| 355 | 355 | $arr['path'] = $this->path; | 
| 356 | 356 | } | 
| 357 | -        if (! empty($this->extensions)) { | |
| 357 | +        if (!empty($this->extensions)) { | |
| 358 | 358 | $arr['extensions'] = $this->extensions; | 
| 359 | 359 | } | 
| 360 | 360 | |
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 |          if ($error->nodes) { | 
| 70 | 70 | /** @var Node $node */ | 
| 71 | 71 |              foreach ($error->nodes as $node) { | 
| 72 | -                if (! $node->loc) { | |
| 72 | +                if (!$node->loc) { | |
| 73 | 73 | continue; | 
| 74 | 74 | } | 
| 75 | 75 | |
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | } | 
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | - return ! $printedLocations | |
| 92 | + return !$printedLocations | |
| 93 | 93 | ? $error->getMessage() | 
| 94 | 94 |              : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; | 
| 95 | 95 | } | 
| @@ -202,17 +202,17 @@ discard block | ||
| 202 | 202 |          if ($e instanceof Error) { | 
| 203 | 203 | $locations = Utils::map( | 
| 204 | 204 | $e->getLocations(), | 
| 205 | -                static function (SourceLocation $loc) : array { | |
| 205 | +                static function(SourceLocation $loc) : array { | |
| 206 | 206 | return $loc->toSerializableArray(); | 
| 207 | 207 | } | 
| 208 | 208 | ); | 
| 209 | -            if (! empty($locations)) { | |
| 209 | +            if (!empty($locations)) { | |
| 210 | 210 | $formattedError['locations'] = $locations; | 
| 211 | 211 | } | 
| 212 | -            if (! empty($e->path)) { | |
| 212 | +            if (!empty($e->path)) { | |
| 213 | 213 | $formattedError['path'] = $e->path; | 
| 214 | 214 | } | 
| 215 | -            if (! empty($e->getExtensions())) { | |
| 215 | +            if (!empty($e->getExtensions())) { | |
| 216 | 216 | $formattedError['extensions'] = $e->getExtensions() + $formattedError['extensions']; | 
| 217 | 217 | } | 
| 218 | 218 | } | 
| @@ -238,7 +238,7 @@ discard block | ||
| 238 | 238 | */ | 
| 239 | 239 | public static function addDebugEntries(array $formattedError, $e, $debug) | 
| 240 | 240 |      { | 
| 241 | -        if (! $debug) { | |
| 241 | +        if (!$debug) { | |
| 242 | 242 | return $formattedError; | 
| 243 | 243 | } | 
| 244 | 244 | |
| @@ -251,7 +251,7 @@ discard block | ||
| 251 | 251 | $debug = (int) $debug; | 
| 252 | 252 | |
| 253 | 253 |          if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { | 
| 254 | -            if (! $e instanceof Error) { | |
| 254 | +            if (!$e instanceof Error) { | |
| 255 | 255 | throw $e; | 
| 256 | 256 | } | 
| 257 | 257 | |
| @@ -260,7 +260,7 @@ discard block | ||
| 260 | 260 | } | 
| 261 | 261 | } | 
| 262 | 262 | |
| 263 | - $isUnsafe = ! $e instanceof ClientAware || ! $e->isClientSafe(); | |
| 263 | + $isUnsafe = !$e instanceof ClientAware || !$e->isClientSafe(); | |
| 264 | 264 | |
| 265 | 265 |          if (($debug & Debug::RETHROW_UNSAFE_EXCEPTIONS) && $isUnsafe) { | 
| 266 | 266 |              if ($e->getPrevious()) { | 
| @@ -281,9 +281,9 @@ discard block | ||
| 281 | 281 | ]; | 
| 282 | 282 | } | 
| 283 | 283 | |
| 284 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); | |
| 284 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); | |
| 285 | 285 | |
| 286 | -            if (! $isTrivial) { | |
| 286 | +            if (!$isTrivial) { | |
| 287 | 287 | $debugging = $e->getPrevious() ?: $e; | 
| 288 | 288 | $formattedError['trace'] = static::toSafeTrace($debugging); | 
| 289 | 289 | } | 
| @@ -302,11 +302,11 @@ discard block | ||
| 302 | 302 | */ | 
| 303 | 303 | public static function prepareFormatter(?callable $formatter = null, $debug) | 
| 304 | 304 |      { | 
| 305 | -        $formatter = $formatter ?: static function ($e) : array { | |
| 305 | +        $formatter = $formatter ?: static function($e) : array { | |
| 306 | 306 | return FormattedError::createFromException($e); | 
| 307 | 307 | }; | 
| 308 | 308 |          if ($debug) { | 
| 309 | -            $formatter = static function ($e) use ($formatter, $debug) : array { | |
| 309 | +            $formatter = static function($e) use ($formatter, $debug) : array { | |
| 310 | 310 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); | 
| 311 | 311 | }; | 
| 312 | 312 | } | 
| @@ -331,18 +331,18 @@ discard block | ||
| 331 | 331 | // Remove invariant entries as they don't provide much value: | 
| 332 | 332 |              ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { | 
| 333 | 333 | array_shift($trace); | 
| 334 | -        } elseif (! isset($trace[0]['file'])) { | |
| 334 | +        } elseif (!isset($trace[0]['file'])) { | |
| 335 | 335 | // Remove root call as it's likely error handler trace: | 
| 336 | 336 | array_shift($trace); | 
| 337 | 337 | } | 
| 338 | 338 | |
| 339 | 339 | return array_map( | 
| 340 | -            static function ($err) : array { | |
| 340 | +            static function($err) : array { | |
| 341 | 341 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); | 
| 342 | 342 | |
| 343 | 343 |                  if (isset($err['function'])) { | 
| 344 | 344 | $func = $err['function']; | 
| 345 | - $args = ! empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; | |
| 345 | + $args = !empty($err['args']) ? array_map([self::class, 'printVar'], $err['args']) : []; | |
| 346 | 346 |                      $funcStr = $func . '(' . implode(', ', $args) . ')'; | 
| 347 | 347 | |
| 348 | 348 |                      if (isset($err['class'])) { | 
| @@ -411,9 +411,9 @@ discard block | ||
| 411 | 411 |      { | 
| 412 | 412 | $formatted = ['message' => $error]; | 
| 413 | 413 | |
| 414 | -        if (! empty($locations)) { | |
| 414 | +        if (!empty($locations)) { | |
| 415 | 415 | $formatted['locations'] = array_map( | 
| 416 | -                static function ($loc) : array { | |
| 416 | +                static function($loc) : array { | |
| 417 | 417 | return $loc->toArray(); | 
| 418 | 418 | }, | 
| 419 | 419 | $locations | 
| @@ -138,8 +138,8 @@ discard block | ||
| 138 | 138 |      { | 
| 139 | 139 | $result = []; | 
| 140 | 140 | |
| 141 | -        if (! empty($this->errors)) { | |
| 142 | -            $errorsHandler = $this->errorsHandler ?: static function (array $errors, callable $formatter) : array { | |
| 141 | +        if (!empty($this->errors)) { | |
| 142 | +            $errorsHandler = $this->errorsHandler ?: static function(array $errors, callable $formatter) : array { | |
| 143 | 143 | return array_map($formatter, $errors); | 
| 144 | 144 | }; | 
| 145 | 145 | |
| @@ -153,7 +153,7 @@ discard block | ||
| 153 | 153 | $result['data'] = $this->data; | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | -        if (! empty($this->extensions)) { | |
| 156 | +        if (!empty($this->extensions)) { | |
| 157 | 157 | $result['extensions'] = $this->extensions; | 
| 158 | 158 | } | 
| 159 | 159 | |
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | public static function runQueue() : void | 
| 42 | 42 |      { | 
| 43 | 43 | $q = self::$queue; | 
| 44 | -        while ($q !== null && ! $q->isEmpty()) { | |
| 44 | +        while ($q !== null && !$q->isEmpty()) { | |
| 45 | 45 | $task = $q->dequeue(); | 
| 46 | 46 | $task(); | 
| 47 | 47 | } | 
| @@ -56,10 +56,10 @@ discard block | ||
| 56 | 56 | } | 
| 57 | 57 |                  if (is_object($value) && method_exists($value, 'then')) { | 
| 58 | 58 | $value->then( | 
| 59 | -                        function ($resolvedValue) : void { | |
| 59 | +                        function($resolvedValue) : void { | |
| 60 | 60 | $this->resolve($resolvedValue); | 
| 61 | 61 | }, | 
| 62 | -                        function ($reason) : void { | |
| 62 | +                        function($reason) : void { | |
| 63 | 63 | $this->reject($reason); | 
| 64 | 64 | } | 
| 65 | 65 | ); | 
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | |
| 86 | 86 | public function reject($reason) : self | 
| 87 | 87 |      { | 
| 88 | -        if (! $reason instanceof Throwable) { | |
| 88 | +        if (!$reason instanceof Throwable) { | |
| 89 | 89 |              throw new Exception('SyncPromise::reject() has to be called with an instance of \Throwable'); | 
| 90 | 90 | } | 
| 91 | 91 | |
| @@ -115,7 +115,7 @@ discard block | ||
| 115 | 115 | ); | 
| 116 | 116 | |
| 117 | 117 |          foreach ($this->waiting as $descriptor) { | 
| 118 | -            self::getQueue()->enqueue(function () use ($descriptor) : void { | |
| 118 | +            self::getQueue()->enqueue(function() use ($descriptor) : void { | |
| 119 | 119 | /** @var self $promise */ | 
| 120 | 120 | [$promise, $onFulfilled, $onRejected] = $descriptor; | 
| 121 | 121 | |
| @@ -80,12 +80,12 @@ | ||
| 80 | 80 | // TODO: rework with generators when PHP minimum required version is changed to 5.5+ | 
| 81 | 81 | $promisesOrValues = Utils::map( | 
| 82 | 82 | $promisesOrValues, | 
| 83 | -            static function ($item) { | |
| 83 | +            static function($item) { | |
| 84 | 84 | return $item instanceof Promise ? $item->adoptedPromise : $item; | 
| 85 | 85 | } | 
| 86 | 86 | ); | 
| 87 | 87 | |
| 88 | -        $promise = all($promisesOrValues)->then(static function ($values) use ($promisesOrValues) : array { | |
| 88 | +        $promise = all($promisesOrValues)->then(static function($values) use ($promisesOrValues) : array { | |
| 89 | 89 | $orderedResults = []; | 
| 90 | 90 | |
| 91 | 91 |              foreach ($promisesOrValues as $key => $value) { | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | */ | 
| 33 | 33 | public function convertThenable($thenable) | 
| 34 | 34 |      { | 
| 35 | -        if (! $thenable instanceof Deferred) { | |
| 35 | +        if (!$thenable instanceof Deferred) { | |
| 36 | 36 |              throw new InvariantViolation('Expected instance of GraphQL\Deferred, got ' . Utils::printSafe($thenable)); | 
| 37 | 37 | } | 
| 38 | 38 | |
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 |              if ($promiseOrValue instanceof Promise) { | 
| 111 | 111 | $result[$index] = null; | 
| 112 | 112 | $promiseOrValue->then( | 
| 113 | -                    static function ($value) use ($index, &$count, $total, &$result, $all) : void { | |
| 113 | +                    static function($value) use ($index, &$count, $total, &$result, $all) : void { | |
| 114 | 114 | $result[$index] = $value; | 
| 115 | 115 | $count++; | 
| 116 | 116 |                          if ($count < $total) { | 
| @@ -145,7 +145,7 @@ discard block | ||
| 145 | 145 | $promiseQueue = SyncPromise::getQueue(); | 
| 146 | 146 | |
| 147 | 147 | while ($promise->adoptedPromise->state === SyncPromise::PENDING && | 
| 148 | - ! ($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) | |
| 148 | + !($dfdQueue->isEmpty() && $promiseQueue->isEmpty()) | |
| 149 | 149 |          ) { | 
| 150 | 150 | Deferred::runQueue(); | 
| 151 | 151 | SyncPromise::runQueue(); | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | /** @var InputType|Type $varType */ | 
| 68 | 68 | $varType = TypeInfo::typeFromAST($schema, $varDefNode->type); | 
| 69 | 69 | |
| 70 | -            if (! Type::isInputType($varType)) { | |
| 70 | +            if (!Type::isInputType($varType)) { | |
| 71 | 71 | // Must use input types for variables. This should be caught during | 
| 72 | 72 | // validation, however is checked again here for safety. | 
| 73 | 73 | $errors[] = new Error( | 
| @@ -82,11 +82,11 @@ discard block | ||
| 82 | 82 | $hasValue = array_key_exists($varName, $inputs); | 
| 83 | 83 | $value = $hasValue ? $inputs[$varName] : Utils::undefined(); | 
| 84 | 84 | |
| 85 | -                if (! $hasValue && $varDefNode->defaultValue) { | |
| 85 | +                if (!$hasValue && $varDefNode->defaultValue) { | |
| 86 | 86 | // If no value was provided to a variable with a default value, | 
| 87 | 87 | // use the default value. | 
| 88 | 88 | $coercedValues[$varName] = AST::valueFromAST($varDefNode->defaultValue, $varType); | 
| 89 | -                } elseif ((! $hasValue || $value === null) && ($varType instanceof NonNull)) { | |
| 89 | +                } elseif ((!$hasValue || $value === null) && ($varType instanceof NonNull)) { | |
| 90 | 90 | // If no value or a nullish value was provided to a variable with a | 
| 91 | 91 | // non-null type (required), produce an error. | 
| 92 | 92 | $errors[] = new Error( | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | } | 
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | -        if (! empty($errors)) { | |
| 139 | +        if (!empty($errors)) { | |
| 140 | 140 | return [$errors, null]; | 
| 141 | 141 | } | 
| 142 | 142 | |
| @@ -160,7 +160,7 @@ discard block | ||
| 160 | 160 |          if (isset($node->directives) && $node->directives instanceof NodeList) { | 
| 161 | 161 | $directiveNode = Utils::find( | 
| 162 | 162 | $node->directives, | 
| 163 | -                static function (DirectiveNode $directive) use ($directiveDef) : bool { | |
| 163 | +                static function(DirectiveNode $directive) use ($directiveDef) : bool { | |
| 164 | 164 | return $directive->name->value === $directiveDef->name; | 
| 165 | 165 | } | 
| 166 | 166 | ); | 
| @@ -233,11 +233,11 @@ discard block | ||
| 233 | 233 | $isNull = $argumentValueNode instanceof NullValueNode; | 
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | -            if (! $hasValue && $argumentDefinition->defaultValueExists()) { | |
| 236 | +            if (!$hasValue && $argumentDefinition->defaultValueExists()) { | |
| 237 | 237 | // If no argument was provided where the definition has a default value, | 
| 238 | 238 | // use the default value. | 
| 239 | 239 | $coercedValues[$name] = $argumentDefinition->defaultValue; | 
| 240 | -            } elseif ((! $hasValue || $isNull) && ($argType instanceof NonNull)) { | |
| 240 | +            } elseif ((!$hasValue || $isNull) && ($argType instanceof NonNull)) { | |
| 241 | 241 | // If no argument or a null value was provided to an argument with a | 
| 242 | 242 | // non-null type (required), produce a field error. | 
| 243 | 243 |                  if ($isNull) { | 
| @@ -327,7 +327,7 @@ discard block | ||
| 327 | 327 | |
| 328 | 328 | return $errors | 
| 329 | 329 | ? array_map( | 
| 330 | -                static function (Throwable $error) : string { | |
| 330 | +                static function(Throwable $error) : string { | |
| 331 | 331 | return $error->getMessage(); | 
| 332 | 332 | }, | 
| 333 | 333 | $errors |