Skip to content

Commit c71bcd8

Browse files
authored
Update TypeDescriber.php
Fix problem when `use ()` with anon function, not import
1 parent 1548055 commit c71bcd8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Generator/TypeDescriber.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ public function getImportsFromFile(string $phpFile): array
373373
if (is_array($token) && $token[0] === T_USE) {
374374
$import = null;
375375
$i += 2;
376+
// if `use (...)` with anonumous function
377+
if (!is_array($tokens[$i]) && $tokens[$i] === '(') {
378+
continue;
379+
}
376380
while (is_array($tokens[$i]) && in_array($tokens[$i][0], $allowed_tokens)) {
377381
if ($tokens[$i][0] !== T_WHITESPACE) {
378382
$import .= defined('T_NAME_FULLY_QUALIFIED') && $tokens[$i][0] === T_NAME_FULLY_QUALIFIED

0 commit comments

Comments
 (0)