Skip to content

Commit

Permalink
Catch ParseToAstFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
jakublabno committed Jul 17, 2022
1 parent abac4b2 commit 7f4e0df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Finder/ClassNameFromPathGeneratorReflectionBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Roave\BetterReflection\Reflection\ReflectionClass;
use Roave\BetterReflection\Reflector\ClassReflector;
use Roave\BetterReflection\Reflector\DefaultReflector;
use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure;
use Roave\BetterReflection\SourceLocator\Type\AbstractSourceLocator;
use Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator;

Expand Down Expand Up @@ -47,6 +48,10 @@ private static function getClasses(AbstractSourceLocator $locator): iterable
$reflectAllClassesMethod = self::NEW_VERSION_REFLECT_CLASSES_METHOD;
}

return (new $locatorClass($locator))->$reflectAllClassesMethod();
try {
return (new $locatorClass($locator))->$reflectAllClassesMethod();
} catch (ParseToAstFailure $exception) {
return [];
}
}
}

0 comments on commit 7f4e0df

Please sign in to comment.