Skip to content

Commit ce24060

Browse files
committed
Fix class declaration detection after ::class references
1 parent 0263204 commit ce24060

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/Commands/BaseCommand.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,14 @@ protected function findClassTokenIndex(array $tokens): ?int
182182
for ($lookahead = $index + 1; isset($tokens[$lookahead]); $lookahead++) {
183183
$nextToken = $tokens[$lookahead];
184184

185-
if (!is_array($nextToken)) {
186-
continue;
187-
}
188-
189-
if (in_array($nextToken[0], [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT], true)) {
190-
continue;
191-
}
185+
if (is_array($nextToken)) {
186+
if (in_array($nextToken[0], [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT], true)) {
187+
continue;
188+
}
192189

193-
if ($nextToken[0] === T_STRING) {
194-
return $index;
190+
if ($nextToken[0] === T_STRING) {
191+
return $index;
192+
}
195193
}
196194

197195
break;

0 commit comments

Comments
 (0)