@@ -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,17 +305,17 @@ 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 | - return array_map(function ($err) { |
|
313 | + return array_map(function($err) { |
|
314 | 314 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
315 | 315 | |
316 | 316 | if (isset($err['function'])) { |
317 | 317 | $func = $err['function']; |
318 | - $args = ! empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
318 | + $args = !empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
319 | 319 | $funcStr = $func . '(' . implode(', ', $args) . ')'; |
320 | 320 | |
321 | 321 | if (isset($err['class'])) { |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | { |
381 | 381 | $formatted = ['message' => $error]; |
382 | 382 | |
383 | - if (! empty($locations)) { |
|
384 | - $formatted['locations'] = array_map(function ($loc) { |
|
383 | + if (!empty($locations)) { |
|
384 | + $formatted['locations'] = array_map(function($loc) { |
|
385 | 385 | return $loc->toArray(); |
386 | 386 | }, |
387 | 387 | $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 | } |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | public function getPositions() |
222 | 222 | { |
223 | 223 | if ($this->positions === null) { |
224 | - if (! empty($this->nodes)) { |
|
225 | - $positions = array_map(function ($node) { |
|
224 | + if (!empty($this->nodes)) { |
|
225 | + $positions = array_map(function($node) { |
|
226 | 226 | return isset($node->loc) ? $node->loc->start : null; |
227 | 227 | }, |
228 | 228 | $this->nodes); |
229 | 229 | $this->positions = array_filter( |
230 | 230 | $positions, |
231 | - function ($p) { |
|
231 | + function($p) { |
|
232 | 232 | return $p !== null; |
233 | 233 | } |
234 | 234 | ); |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | $nodes = $this->nodes; |
261 | 261 | |
262 | 262 | if ($positions && $source) { |
263 | - $this->locations = array_map(function ($pos) use ($source) { |
|
263 | + $this->locations = array_map(function($pos) use ($source) { |
|
264 | 264 | return $source->getLocation($pos); |
265 | 265 | }, |
266 | 266 | $positions); |
267 | 267 | } elseif ($nodes) { |
268 | - $this->locations = array_filter(array_map(function ($node) { |
|
268 | + $this->locations = array_filter(array_map(function($node) { |
|
269 | 269 | if ($node->loc) { |
270 | 270 | return $node->loc->source->getLocation($node->loc->start); |
271 | 271 | } |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | |
326 | 326 | $locations = Utils::map( |
327 | 327 | $this->getLocations(), |
328 | - function (SourceLocation $loc) { |
|
328 | + function(SourceLocation $loc) { |
|
329 | 329 | return $loc->toSerializableArray(); |
330 | 330 | } |
331 | 331 | ); |
332 | 332 | |
333 | - if (! empty($locations)) { |
|
333 | + if (!empty($locations)) { |
|
334 | 334 | $arr['locations'] = $locations; |
335 | 335 | } |
336 | - if (! empty($this->path)) { |
|
336 | + if (!empty($this->path)) { |
|
337 | 337 | $arr['path'] = $this->path; |
338 | 338 | } |
339 | 339 |