Skip to content

Commit

Permalink
Checking if the reflection is anonymous before parsing file tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
odahcam committed Sep 5, 2023
1 parent 50f9235 commit 201e9c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Doctrine/Common/Annotations/PhpParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public function parseUseStatements($reflection): array
return $reflection->getUseStatements();
}

// we can't rely on the file's namespaces when the class is anonymous
if ($reflection->isAnonymous()) {
return [];
}

$filename = $reflection->getFileName();

if ($filename === false) {
Expand Down

0 comments on commit 201e9c7

Please sign in to comment.