@@ -136,7 +136,7 @@ public function exceptionHandler(Throwable $exception)
136136 'routeInfo ' => $ routeInfo ,
137137 'exFile ' => clean_path ($ exception ->getFile ()), // {file} refers to THIS file
138138 'exLine ' => $ exception ->getLine (), // {line} refers to THIS line
139- 'trace ' => self :: renderBacktrace ($ exception ->getTrace ()),
139+ 'trace ' => render_backtrace ($ exception ->getTrace ()),
140140 ]);
141141
142142 // Get the first exception.
@@ -149,7 +149,7 @@ public function exceptionHandler(Throwable $exception)
149149 'message ' => $ prevException ->getMessage (),
150150 'exFile ' => clean_path ($ prevException ->getFile ()), // {file} refers to THIS file
151151 'exLine ' => $ prevException ->getLine (), // {line} refers to THIS line
152- 'trace ' => self :: renderBacktrace ($ prevException ->getTrace ()),
152+ 'trace ' => render_backtrace ($ prevException ->getTrace ()),
153153 ]);
154154 }
155155 }
@@ -527,7 +527,7 @@ private function handleDeprecationError(string $message, ?string $file = null, ?
527527 'message ' => $ message ,
528528 'errFile ' => clean_path ($ file ?? '' ),
529529 'errLine ' => $ line ?? 0 ,
530- 'trace ' => self :: renderBacktrace ($ trace ),
530+ 'trace ' => render_backtrace ($ trace ),
531531 ],
532532 );
533533
@@ -646,41 +646,4 @@ public static function highlightFile(string $file, int $lineNumber, int $lines =
646646
647647 return '<pre><code> ' . $ out . '</code></pre> ' ;
648648 }
649-
650- private static function renderBacktrace (array $ backtrace ): string
651- {
652- $ backtraces = [];
653-
654- foreach ($ backtrace as $ index => $ trace ) {
655- $ frame = $ trace + ['file ' => '[internal function] ' , 'line ' => '' , 'class ' => '' , 'type ' => '' , 'args ' => []];
656-
657- if ($ frame ['file ' ] !== '[internal function] ' ) {
658- $ frame ['file ' ] = sprintf ('%s(%s) ' , $ frame ['file ' ], $ frame ['line ' ]);
659- }
660-
661- unset($ frame ['line ' ]);
662- $ idx = $ index ;
663- $ idx = str_pad ((string ) ++$ idx , 2 , ' ' , STR_PAD_LEFT );
664-
665- $ args = implode (', ' , array_map (static fn ($ value ): string => match (true ) {
666- is_object ($ value ) => sprintf ('Object(%s) ' , $ value ::class),
667- is_array ($ value ) => $ value !== [] ? '[...] ' : '[] ' ,
668- $ value === null => 'null ' ,
669- is_resource ($ value ) => sprintf ('resource (%s) ' , get_resource_type ($ value )),
670- default => var_export ($ value , true ),
671- }, $ frame ['args ' ]));
672-
673- $ backtraces [] = sprintf (
674- '%s %s: %s%s%s(%s) ' ,
675- $ idx ,
676- clean_path ($ frame ['file ' ]),
677- $ frame ['class ' ],
678- $ frame ['type ' ],
679- $ frame ['function ' ],
680- $ args ,
681- );
682- }
683-
684- return implode ("\n" , $ backtraces );
685- }
686649}
0 commit comments