Skip to content

Commit 882164d

Browse files
committed
Model Resolving error handling - Fix #4
1 parent cbc6c93 commit 882164d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/ModelResolver.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,15 @@ private function extractClassname($file): string
9191
}
9292
}
9393

94-
if ($tokens[$i][0] === T_CLASS)
95-
for ($j = $i + 1; $j < count($tokens); $j++)
96-
if ($tokens[$j] === '{')
97-
$class = $tokens[$i + 2][1];
94+
if ($tokens[$i][0] === T_CLASS) {
95+
for ($j = $i + 1; $j < count($tokens); $j++) {
96+
if ($tokens[$j] === '{') {
97+
if (is_array($tokens[$i + 2]) && isset($tokens[$i + 2][1])) {
98+
$class = $tokens[$i + 2][1];
99+
}
100+
}
101+
}
102+
}
98103
}
99104
}
100105

0 commit comments

Comments
 (0)