Skip to content

Commit 37168ec

Browse files
committed
Fix small issue in DBDebug
Did not work for helper functions like array_map - also added explanation in code comment.
1 parent d334456 commit 37168ec

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.gitattributes

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/tests export-ignore
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
4-
/phpunit.xml export-ignore
5-
/phpcs.xml export-ignore
4+
/phpunit.xml.dist export-ignore
5+
/phpcs.xml.dist export-ignore
66
/captainhook.json export-ignore
7-
/.travis.yml export-ignore
7+
/.travis.yml export-ignore
8+
/ruleset.xml export-ignore
9+
/.editorconfig export-ignore
10+
/phpstan.neon export-ignore

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<directory suffix=".php">src</directory>
1919
<exclude>
2020
<directory>src/TestHelpers</directory>
21+
<directory>src/DBDebug.php</directory>
2122
</exclude>
2223
</whitelist>
2324
</filter>

src/DBDebug.php

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

3333
// Go through backtrace and find the topmost caller
3434
foreach ($backtraceList as $backtrace) {
35+
// We are only going through classes - this is necessary because of
36+
// helper functions like array_map, which otherwise come up in the backtrace
37+
if (!isset($backtrace['class'])) {
38+
continue;
39+
}
40+
3541
// Replace backtrace instance if we find a valid class insance
3642
foreach ($backtraceClasses as $backtraceClass) {
3743
// Check if the class or interface we are looking for is implemented or used

0 commit comments

Comments
 (0)