Skip to content

Commit a5712bf

Browse files
committed
Hotfix: ensuring that root namespaces are imported correctly (not stripping first char)
1 parent 7c25248 commit a5712bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Types/ContextFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ private function extractUseStatement(\ArrayIterator $tokens)
168168
}
169169

170170
if (count($result) == 1) {
171-
$result[] = substr($result[0], strrpos($result[0], '\\') + 1);
171+
$backslashPos = strrpos($result[0], '\\');
172+
173+
if (false !== $backslashPos) {
174+
$result[] = substr($result[0], $backslashPos + 1);
175+
} else {
176+
$result[] = $result[0];
177+
}
172178
}
173179

174180
return array_reverse($result);

0 commit comments

Comments
 (0)