Skip to content

Commit 910e4d9

Browse files
committed
Make DBDebug work with static calls
1 parent 21126bd commit 910e4d9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/DBDebug.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public static function createException(string $exceptionClass, $backtraceClasses
3232

3333
// Go through backtrace and find the topmost caller
3434
foreach ($backtraceList as $backtrace) {
35-
// If we are not in an object context, we go further until we find one
36-
if (!isset($backtrace['object'])) {
37-
continue;
38-
}
39-
4035
// Replace backtrace instance if we find a valid class insance
4136
foreach ($backtraceClasses as $backtraceClass) {
42-
if ($backtrace['object'] instanceof $backtraceClass) {
37+
// Check if the class or interface we are looking for is implemented or used
38+
// by the current backtrace class
39+
if (\in_array($backtraceClass, \class_implements($backtrace['class'])) ||
40+
\in_array($backtraceClass, \class_parents($backtrace['class'])) ||
41+
$backtraceClass === $backtrace['class']
42+
) {
4343
$lastInstance = $backtrace;
4444
$assignedBacktraceClass = $backtraceClass;
4545
}

0 commit comments

Comments
 (0)