@@ -67,7 +67,7 @@ public static function printError(Error $error): string
67
67
68
68
return $ printedLocations === []
69
69
? $ error ->getMessage ()
70
- : \ implode ("\n\n" , \ array_merge ([$ error ->getMessage ()], $ printedLocations )) . "\n" ;
70
+ : implode ("\n\n" , array_merge ([$ error ->getMessage ()], $ printedLocations )) . "\n" ;
71
71
}
72
72
73
73
/**
@@ -84,7 +84,7 @@ private static function highlightSourceAtLocation(Source $source, SourceLocation
84
84
$ prevLineNum = (string ) ($ contextLine - 1 );
85
85
$ lineNum = (string ) $ contextLine ;
86
86
$ nextLineNum = (string ) ($ contextLine + 1 );
87
- $ padLen = \ strlen ($ nextLineNum );
87
+ $ padLen = strlen ($ nextLineNum );
88
88
89
89
$ lines = Utils::splitLines ($ source ->body );
90
90
$ lines [0 ] = self ::spaces ($ source ->locationOffset ->column - 1 ) . $ lines [0 ];
@@ -94,10 +94,10 @@ private static function highlightSourceAtLocation(Source $source, SourceLocation
94
94
$ line >= 2 ? (self ::leftPad ($ padLen , $ prevLineNum ) . ': ' . $ lines [$ line - 2 ]) : null ,
95
95
self ::leftPad ($ padLen , $ lineNum ) . ': ' . $ lines [$ line - 1 ],
96
96
self ::spaces (2 + $ padLen + $ contextColumn - 1 ) . '^ ' ,
97
- $ line < \ count ($ lines ) ? self ::leftPad ($ padLen , $ nextLineNum ) . ': ' . $ lines [$ line ] : null ,
97
+ $ line < count ($ lines ) ? self ::leftPad ($ padLen , $ nextLineNum ) . ': ' . $ lines [$ line ] : null ,
98
98
];
99
99
100
- return \ implode ("\n" , \ array_filter ($ outputLines ));
100
+ return implode ("\n" , array_filter ($ outputLines ));
101
101
}
102
102
103
103
private static function getColumnOffset (Source $ source , SourceLocation $ location ): int
@@ -109,12 +109,12 @@ private static function getColumnOffset(Source $source, SourceLocation $location
109
109
110
110
private static function spaces (int $ length ): string
111
111
{
112
- return \ str_repeat (' ' , $ length );
112
+ return str_repeat (' ' , $ length );
113
113
}
114
114
115
115
private static function leftPad (int $ length , string $ str ): string
116
116
{
117
- return self ::spaces ($ length - \ mb_strlen ($ str )) . $ str ;
117
+ return self ::spaces ($ length - mb_strlen ($ str )) . $ str ;
118
118
}
119
119
120
120
/**
@@ -140,7 +140,7 @@ public static function createFromException(\Throwable $exception, int $debugFlag
140
140
$ formattedError = ['message ' => $ message ];
141
141
142
142
if ($ exception instanceof Error) {
143
- $ locations = \ array_map (
143
+ $ locations = array_map (
144
144
static fn (SourceLocation $ loc ): array => $ loc ->toSerializableArray (),
145
145
$ exception ->getLocations ()
146
146
);
@@ -155,7 +155,7 @@ public static function createFromException(\Throwable $exception, int $debugFlag
155
155
156
156
if ($ exception instanceof ProvidesExtensions) {
157
157
$ extensions = $ exception ->getExtensions ();
158
- if (\ is_array ($ extensions ) && $ extensions !== []) {
158
+ if (is_array ($ extensions ) && $ extensions !== []) {
159
159
$ formattedError ['extensions ' ] = $ extensions ;
160
160
}
161
161
}
@@ -258,10 +258,10 @@ public static function toSafeTrace(\Throwable $error): array
258
258
// Remove invariant entries as they don't provide much value:
259
259
&& ($ trace [0 ]['class ' ] . ':: ' . $ trace [0 ]['function ' ] === 'GraphQL\Utils\Utils::invariant ' )
260
260
) {
261
- \ array_shift ($ trace );
261
+ array_shift ($ trace );
262
262
} elseif (! isset ($ trace [0 ]['file ' ])) {
263
263
// Remove root call as it's likely error handler trace:
264
- \ array_shift ($ trace );
264
+ array_shift ($ trace );
265
265
}
266
266
267
267
$ formatted = [];
@@ -277,8 +277,8 @@ public static function toSafeTrace(\Throwable $error): array
277
277
}
278
278
279
279
$ func = $ err ['function ' ];
280
- $ args = \ array_map ([self ::class, 'printVar ' ], $ err ['args ' ] ?? []);
281
- $ funcStr = $ func . '( ' . \ implode (', ' , $ args ) . ') ' ;
280
+ $ args = array_map ([self ::class, 'printVar ' ], $ err ['args ' ] ?? []);
281
+ $ funcStr = $ func . '( ' . implode (', ' , $ args ) . ') ' ;
282
282
283
283
if (isset ($ err ['class ' ])) {
284
284
$ safeErr ['call ' ] = $ err ['class ' ] . ':: ' . $ funcStr ;
@@ -299,39 +299,39 @@ public static function printVar($var): string
299
299
return 'GraphQLType: ' . $ var ->toString ();
300
300
}
301
301
302
- if (\ is_object ($ var )) {
302
+ if (is_object ($ var )) {
303
303
// Calling `count` on instances of `PHPUnit\Framework\Test` triggers an unintended side effect - see https://github.com/sebastianbergmann/phpunit/issues/5866#issuecomment-2172429263
304
304
$ count = ! $ var instanceof Test && $ var instanceof \Countable
305
- ? '( ' . \ count ($ var ) . ') '
305
+ ? '( ' . count ($ var ) . ') '
306
306
: '' ;
307
307
308
- return 'instance of ' . \ get_class ($ var ) . $ count ;
308
+ return 'instance of ' . get_class ($ var ) . $ count ;
309
309
}
310
310
311
- if (\ is_array ($ var )) {
312
- return 'array( ' . \ count ($ var ) . ') ' ;
311
+ if (is_array ($ var )) {
312
+ return 'array( ' . count ($ var ) . ') ' ;
313
313
}
314
314
315
315
if ($ var === '' ) {
316
316
return '(empty string) ' ;
317
317
}
318
318
319
- if (\ is_string ($ var )) {
320
- return "' " . \ addcslashes ($ var , "' " ) . "' " ;
319
+ if (is_string ($ var )) {
320
+ return "' " . addcslashes ($ var , "' " ) . "' " ;
321
321
}
322
322
323
- if (\ is_bool ($ var )) {
323
+ if (is_bool ($ var )) {
324
324
return $ var ? 'true ' : 'false ' ;
325
325
}
326
326
327
- if (\ is_scalar ($ var )) {
327
+ if (is_scalar ($ var )) {
328
328
return (string ) $ var ;
329
329
}
330
330
331
331
if ($ var === null ) {
332
332
return 'null ' ;
333
333
}
334
334
335
- return \ gettype ($ var );
335
+ return gettype ($ var );
336
336
}
337
337
}
0 commit comments