Skip to content

Commit 37b796c

Browse files
authored
[NodeAnalyzer] Handle no repositoryClass on RepositoryClassResolver (#379)
avoid error: ``` "System error: "PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider::hasClass(): Argument #1 ($className) must be of type string, null given, called in ```
1 parent b3f42fd commit 37b796c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NodeAnalyzer/RepositoryClassResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public function resolveFromEntityClass(string $entityClassName): ?string
5656
$repositoryClass = $match['repositoryClass'];
5757
}
5858

59+
if ($repositoryClass === null) {
60+
return null;
61+
}
62+
5963
if (! $this->reflectionProvider->hasClass($repositoryClass)) {
6064
throw new ShouldNotHappenException(
6165
sprintf('Repository class "%s" for entity "%s" does not exist', $repositoryClass, $entityClassName)

0 commit comments

Comments
 (0)