File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,23 +336,24 @@ public function getReferenceId(array $arr, string|int $key): ?int
336336 private static function findLocation (): ?array
337337 {
338338 foreach (debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS ) as $ item ) {
339- if (isset ($ item ['class ' ]) && ($ item ['class ' ] === self ::class || $ item ['class ' ] === Tracy \Dumper::class)) {
339+ $ reflection = null ;
340+ if (isset ($ item ['class ' ])) {
341+ if ($ item ['class ' ] === self ::class || $ item ['class ' ] === Tracy \Dumper::class) {
342+ $ location = $ item ;
343+ continue ;
344+ } elseif (method_exists ($ item ['class ' ], $ item ['function ' ])) {
345+ $ reflection = new \ReflectionMethod ($ item ['class ' ], $ item ['function ' ]);
346+ }
347+ } elseif (function_exists ($ item ['function ' ])) {
348+ $ reflection = new \ReflectionFunction ($ item ['function ' ]);
349+ }
350+
351+ if (
352+ $ reflection ?->isInternal()
353+ || preg_match ('#\s@tracySkipLocation\s# ' , (string ) $ reflection ?->getDocComment())
354+ ) {
340355 $ location = $ item ;
341356 continue ;
342- } elseif (isset ($ item ['function ' ])) {
343- try {
344- $ reflection = isset ($ item ['class ' ])
345- ? new \ReflectionMethod ($ item ['class ' ], $ item ['function ' ])
346- : new \ReflectionFunction ($ item ['function ' ]);
347- if (
348- $ reflection ->isInternal ()
349- || preg_match ('#\s@tracySkipLocation\s# ' , (string ) $ reflection ->getDocComment ())
350- ) {
351- $ location = $ item ;
352- continue ;
353- }
354- } catch (\ReflectionException ) {
355- }
356357 }
357358
358359 break ;
You can’t perform that action at this time.
0 commit comments