Skip to content

Commit 1970a5a

Browse files
Document assumption that we have 3 stack frames
1 parent 1bb2b2c commit 1970a5a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Runner/ErrorHandler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use const E_USER_NOTICE;
2626
use const E_USER_WARNING;
2727
use const E_WARNING;
28+
use function assert;
2829
use function debug_backtrace;
2930
use function error_reporting;
3031
use function restore_error_handler;
@@ -74,8 +75,12 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil
7475
return false;
7576
}
7677

78+
$test = Event\Code\TestMethodBuilder::fromCallStack();
79+
7780
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
78-
$test = Event\Code\TestMethodBuilder::fromCallStack();
81+
82+
assert(isset($trace[1]['file']));
83+
assert(isset($trace[2]['file']));
7984

8085
$ignoredByBaseline = $this->ignoredByBaseline($errorFile, $errorLine, $errorString);
8186
$ignoredByTest = $test->metadata()->isIgnoreDeprecations()->isNotEmpty();

0 commit comments

Comments
 (0)