@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - return ! $printedLocations |
|
60 | + return !$printedLocations |
|
61 | 61 | ? $error->getMessage() |
62 | 62 | : join("\n\n", array_merge([$error->getMessage()], $printedLocations)) . "\n"; |
63 | 63 | } |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | $locations = Utils::map($e->getLocations(), |
171 | - function (SourceLocation $loc) { |
|
171 | + function(SourceLocation $loc) { |
|
172 | 172 | return $loc->toSerializableArray(); |
173 | 173 | }); |
174 | 174 | |
175 | - if (! empty($locations)) { |
|
175 | + if (!empty($locations)) { |
|
176 | 176 | $formattedError['locations'] = $locations; |
177 | 177 | } |
178 | - if (! empty($e->path)) { |
|
178 | + if (!empty($e->path)) { |
|
179 | 179 | $formattedError['path'] = $e->path; |
180 | 180 | } |
181 | 181 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public static function addDebugEntries(array $formattedError, $e, $debug) |
201 | 201 | { |
202 | - if (! $debug) { |
|
202 | + if (!$debug) { |
|
203 | 203 | return $formattedError; |
204 | 204 | } |
205 | 205 | |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $debug = (int) $debug; |
213 | 213 | |
214 | 214 | if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { |
215 | - if (! $e instanceof Error) { |
|
215 | + if (!$e instanceof Error) { |
|
216 | 216 | throw $e; |
217 | 217 | } elseif ($e->getPrevious()) { |
218 | 218 | throw $e->getPrevious(); |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); |
|
222 | + $isInternal = !$e instanceof ClientAware || !$e->isClientSafe(); |
|
223 | 223 | |
224 | 224 | if (($debug & Debug::INCLUDE_DEBUG_MESSAGE) && $isInternal) { |
225 | 225 | // Displaying debugMessage as a first entry: |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | ]; |
235 | 235 | } |
236 | 236 | |
237 | - $isTrivial = $e instanceof Error && ! $e->getPrevious(); |
|
237 | + $isTrivial = $e instanceof Error && !$e->getPrevious(); |
|
238 | 238 | |
239 | - if (! $isTrivial) { |
|
239 | + if (!$isTrivial) { |
|
240 | 240 | $debugging = $e->getPrevious() ?: $e; |
241 | 241 | $formattedError['trace'] = static::toSafeTrace($debugging); |
242 | 242 | } |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public static function prepareFormatter(callable $formatter = null, $debug) |
257 | 257 | { |
258 | - $formatter = $formatter ?: function ($e) { |
|
258 | + $formatter = $formatter ?: function($e) { |
|
259 | 259 | return FormattedError::createFromException($e); |
260 | 260 | }; |
261 | 261 | if ($debug) { |
262 | - $formatter = function ($e) use ($formatter, $debug) { |
|
262 | + $formatter = function($e) use ($formatter, $debug) { |
|
263 | 263 | return FormattedError::addDebugEntries($formatter($e), $e, $debug); |
264 | 264 | }; |
265 | 265 | } |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | ('GraphQL\Utils\Utils::invariant' === $trace[0]['class'] . '::' . $trace[0]['function'])) { |
285 | 285 | array_shift($trace); |
286 | 286 | } // Remove root call as it's likely error handler trace: |
287 | - elseif (! isset($trace[0]['file'])) { |
|
287 | + elseif (!isset($trace[0]['file'])) { |
|
288 | 288 | array_shift($trace); |
289 | 289 | } |
290 | 290 | |
291 | - return array_map(function ($err) { |
|
291 | + return array_map(function($err) { |
|
292 | 292 | $safeErr = array_intersect_key($err, ['file' => true, 'line' => true]); |
293 | 293 | |
294 | 294 | if (isset($err['function'])) { |
295 | 295 | $func = $err['function']; |
296 | - $args = ! empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
296 | + $args = !empty($err['args']) ? array_map([__CLASS__, 'printVar'], $err['args']) : []; |
|
297 | 297 | $funcStr = $func . '(' . implode(", ", $args) . ')'; |
298 | 298 | |
299 | 299 | if (isset($err['class'])) { |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | 'message' => $error, |
361 | 361 | ]; |
362 | 362 | |
363 | - if (! empty($locations)) { |
|
364 | - $formatted['locations'] = array_map(function ($loc) { |
|
363 | + if (!empty($locations)) { |
|
364 | + $formatted['locations'] = array_map(function($loc) { |
|
365 | 365 | return $loc->toArray(); |
366 | 366 | }, |
367 | 367 | $locations); |
@@ -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 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // Compute list of blame nodes. |
163 | 163 | if ($nodes instanceof \Traversable) { |
164 | 164 | $nodes = iterator_to_array($nodes); |
165 | - } elseif ($nodes && ! is_array($nodes)) { |
|
165 | + } elseif ($nodes && !is_array($nodes)) { |
|
166 | 166 | $nodes = [$nodes]; |
167 | 167 | } |
168 | 168 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | public function getSource() |
211 | 211 | { |
212 | 212 | if (null === $this->source) { |
213 | - if (! empty($this->nodes[0]) && ! empty($this->nodes[0]->loc)) { |
|
213 | + if (!empty($this->nodes[0]) && !empty($this->nodes[0]->loc)) { |
|
214 | 214 | $this->source = $this->nodes[0]->loc->source; |
215 | 215 | } |
216 | 216 | } |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | public function getPositions() |
225 | 225 | { |
226 | 226 | if (null === $this->positions) { |
227 | - if (! empty($this->nodes)) { |
|
228 | - $positions = array_map(function ($node) { |
|
227 | + if (!empty($this->nodes)) { |
|
228 | + $positions = array_map(function($node) { |
|
229 | 229 | return isset($node->loc) ? $node->loc->start : null; |
230 | 230 | }, |
231 | 231 | $this->nodes); |
232 | 232 | $this->positions = array_filter($positions, |
233 | - function ($p) { |
|
233 | + function($p) { |
|
234 | 234 | return $p !== null; |
235 | 235 | }); |
236 | 236 | } |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | $nodes = $this->nodes; |
262 | 262 | |
263 | 263 | if ($positions && $source) { |
264 | - $this->locations = array_map(function ($pos) use ($source) { |
|
264 | + $this->locations = array_map(function($pos) use ($source) { |
|
265 | 265 | return $source->getLocation($pos); |
266 | 266 | }, |
267 | 267 | $positions); |
268 | 268 | } elseif ($nodes) { |
269 | - $this->locations = array_filter(array_map(function ($node) { |
|
269 | + $this->locations = array_filter(array_map(function($node) { |
|
270 | 270 | if ($node->loc) { |
271 | 271 | return $node->loc->source->getLocation($node->loc->start); |
272 | 272 | } |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | $locations = Utils::map($this->getLocations(), |
328 | - function (SourceLocation $loc) { |
|
328 | + function(SourceLocation $loc) { |
|
329 | 329 | return $loc->toSerializableArray(); |
330 | 330 | }); |
331 | 331 | |
332 | - if (! empty($locations)) { |
|
332 | + if (!empty($locations)) { |
|
333 | 333 | $arr['locations'] = $locations; |
334 | 334 | } |
335 | - if (! empty($this->path)) { |
|
335 | + if (!empty($this->path)) { |
|
336 | 336 | $arr['path'] = $this->path; |
337 | 337 | } |
338 | 338 |