Skip to content

Cleanup EntityRepositoryClassReflectionExtension#740

Merged
staabm merged 1 commit intophpstan:2.0.xfrom
staabm:repo
Apr 14, 2026
Merged

Cleanup EntityRepositoryClassReflectionExtension#740
staabm merged 1 commit intophpstan:2.0.xfrom
staabm:repo

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Apr 14, 2026

looking into this right now, because we see CI errors related to this lines of code in phpstan/phpstan-src#5449

strpos($methodName, 'findOneBy') === 0
) {
$returnType = TypeCombinator::union($entityClassType, new NullType());
$returnType = TypeCombinator::addNull($entityClassType);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by cleanup

Comment on lines -91 to -94
$repositoryAncesor = $classReflection->getAncestorWithClassName(ObjectRepository::class);
if ($repositoryAncesor === null) {
throw new ShouldNotHappenException();
}
Copy link
Copy Markdown
Contributor Author

@staabm staabm Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the past this code was used to support ObjectRepository classes from different namespaces (across different major versions of doctrine), see a497a38#diff-3cbc418c0bd3c05155f1b1f786e9a6c12efe64d7599b402dbd19299942061b74R47-R53

the remaining code references the very same class which is a leftover of this feature which no longer exists

@staabm staabm requested a review from VincentLanglet April 14, 2026 05:07
@staabm staabm merged commit 1650f18 into phpstan:2.0.x Apr 14, 2026
50 of 51 checks passed
@staabm staabm deleted the repo branch April 14, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants