@@ -86,7 +86,7 @@ |
||
| 86 | 86 | if (self::$warningHandler) { |
| 87 | 87 | $fn = self::$warningHandler; |
| 88 | 88 | $fn($errorMessage, $warningId); |
| 89 | - } elseif ((self::$enableWarnings & $warningId) > 0 && ! isset(self::$warned[$warningId])) { |
|
| 89 | + } elseif ((self::$enableWarnings & $warningId) > 0 && !isset(self::$warned[$warningId])) { |
|
| 90 | 90 | self::$warned[$warningId] = true; |
| 91 | 91 | trigger_error($errorMessage, $messageLevel ?: E_USER_WARNING); |
| 92 | 92 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if ($error->nodes) { |
| 66 | 66 | /** @var Node $node */ |
| 67 | 67 | foreach ($error->nodes as $node) { |
| 68 | - if (! $node->loc) { |
|
| 68 | + if (!$node->loc) { |
|
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - return ! $printedLocations |
|
| 84 | + return !$printedLocations |
|
| 85 | 85 | ? $error->getMessage() |
| 86 | 86 | : implode("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
| 87 | 87 | } |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $locations = Utils::map( |
| 191 | 191 | $e->getLocations(), |
| 192 | - function (SourceLocation $loc) { |
|
| 192 | + function(SourceLocation $loc) { |
|
| 193 | 193 | return $loc->toSerializableArray(); |
| 194 | 194 | } |
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - if (! empty($locations)) { |
|
| 197 | + if (!empty($locations)) { |
|
| 198 | 198 | $formattedError['locations'] = $locations; |
| 199 | 199 | } |
| 200 | - if (! empty($e->path)) { |
|
| 200 | + if (!empty($e->path)) { |
|
| 201 | 201 | $formattedError['path'] = $e->path; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public static function addDebugEntries(array $formattedError, $e, $debug) |
| 223 | 223 | { |
| 224 | - if (! $debug) { |
|
| 224 | + if (!$debug) { |
|
| 225 | 225 | return $formattedError; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $debug = (int) $debug; |
| 235 | 235 | |
| 236 | 236 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
| 237 | - if (! $e instanceof Error) { |
|
| 237 | + if (!$e instanceof Error) { |
|
| 238 | 238 | throw $e; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
| 246 | + $isInternal = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
| 247 | 247 | |
| 248 | 248 | if (($debug & Debug::INCLUDE_DEBUG_MESSAGE) && $isInternal) { |
| 249 | 249 | // Displaying debugMessage as a first entry: |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | ]; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
| 261 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
| 262 | 262 | |
| 263 | - if (! $isTrivial) { |
|
| 263 | + if (!$isTrivial) { |
|
| 264 | 264 | $debugging = $e->getPrevious() ?: $e; |
| 265 | 265 | $formattedError['trace'] = static::toSafeTrace($debugging); |
| 266 | 266 | } |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | public static function prepareFormatter(?callable $formatter = null, $debug) |
| 280 | 280 | { |
| 281 | - $formatter = $formatter ?: function ($e) { |
|
| 281 | + $formatter = $formatter ?: function($e) { |
|
| 282 | 282 | return FormattedError::createFromException($e); |
| 283 | 283 | }; |
| 284 | 284 | if ($debug) { |
| 285 | - $formatter = function ($e) use ($formatter, $debug) { |
|
| 285 | + $formatter = function($e) use ($formatter, $debug) { |
|
| 286 | 286 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
| 287 | 287 | }; |
| 288 | 288 | } |
@@ -305,18 +305,18 @@ discard block |
||
| 305 | 305 | // Remove invariant entries as they don't provide much value: |
| 306 | 306 | ($trace[0]['class'] . '::' . $trace[0]['function'] === 'GraphQL\Utils\Utils::invariant')) { |
| 307 | 307 | array_shift($trace); |
| 308 | - } elseif (! isset($trace[0]['file'])) { |
|
| 308 | + } elseif (!isset($trace[0]['file'])) { |
|
| 309 | 309 | // Remove root call as it's likely error handler trace: |
| 310 | 310 | array_shift($trace); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | return array_map( |
| 314 | - function ($err) { |
|
| 314 | + function($err) { |
|
| 315 | 315 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
| 316 | 316 | |
| 317 | 317 | if (isset($err['function'])) { |
| 318 | 318 | $func = $err['function']; |
| 319 | - $args = ! empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
| 319 | + $args = !empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
| 320 | 320 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
| 321 | 321 | |
| 322 | 322 | if (isset($err['class'])) { |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | { |
| 383 | 383 | $formatted = ['message' => $error]; |
| 384 | 384 | |
| 385 | - if (! empty($locations)) { |
|
| 385 | + if (!empty($locations)) { |
|
| 386 | 386 | $formatted['locations'] = array_map( |
| 387 | - function ($loc) { |
|
| 387 | + function($loc) { |
|
| 388 | 388 | return $loc->toArray(); |
| 389 | 389 | }, |
| 390 | 390 | $locations |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | // Compute list of blame nodes. |
| 103 | 103 | if ($nodes instanceof \Traversable) { |
| 104 | 104 | $nodes = iterator_to_array($nodes); |
| 105 | - } elseif ($nodes && ! is_array($nodes)) { |
|
| 105 | + } elseif ($nodes && !is_array($nodes)) { |
|
| 106 | 106 | $nodes = [$nodes]; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | public function getSource() |
| 208 | 208 | { |
| 209 | 209 | if ($this->source === null) { |
| 210 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
| 210 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
| 211 | 211 | $this->source = $this->nodes[0]->loc->source; |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function getPositions() |
| 222 | 222 | { |
| 223 | - if ($this->positions === null && ! empty($this->nodes)) { |
|
| 223 | + if ($this->positions === null && !empty($this->nodes)) { |
|
| 224 | 224 | $positions = array_map( |
| 225 | - function ($node) { |
|
| 225 | + function($node) { |
|
| 226 | 226 | return isset($node->loc) ? $node->loc->start : null; |
| 227 | 227 | }, |
| 228 | 228 | $this->nodes |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $this->positions = array_filter( |
| 232 | 232 | $positions, |
| 233 | - function ($p) { |
|
| 233 | + function($p) { |
|
| 234 | 234 | return $p !== null; |
| 235 | 235 | } |
| 236 | 236 | ); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | if ($positions && $source) { |
| 264 | 264 | $this->locations = array_map( |
| 265 | - function ($pos) use ($source) { |
|
| 265 | + function($pos) use ($source) { |
|
| 266 | 266 | return $source->getLocation($pos); |
| 267 | 267 | }, |
| 268 | 268 | $positions |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } elseif ($nodes) { |
| 271 | 271 | $this->locations = array_filter( |
| 272 | 272 | array_map( |
| 273 | - function ($node) { |
|
| 273 | + function($node) { |
|
| 274 | 274 | if ($node->loc) { |
| 275 | 275 | return $node->loc->source->getLocation($node->loc->start); |
| 276 | 276 | } |
@@ -332,15 +332,15 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $locations = Utils::map( |
| 334 | 334 | $this->getLocations(), |
| 335 | - function (SourceLocation $loc) { |
|
| 335 | + function(SourceLocation $loc) { |
|
| 336 | 336 | return $loc->toSerializableArray(); |
| 337 | 337 | } |
| 338 | 338 | ); |
| 339 | 339 | |
| 340 | - if (! empty($locations)) { |
|
| 340 | + if (!empty($locations)) { |
|
| 341 | 341 | $arr['locations'] = $locations; |
| 342 | 342 | } |
| 343 | - if (! empty($this->path)) { |
|
| 343 | + if (!empty($this->path)) { |
|
| 344 | 344 | $arr['path'] = $this->path; |
| 345 | 345 | } |
| 346 | 346 | |