Remove Reflector from StubFilesExtensionLoader, add regression test#747
Open
xificurk wants to merge 1 commit intophpstan:2.0.xfrom
Open
Remove Reflector from StubFilesExtensionLoader, add regression test#747xificurk wants to merge 1 commit intophpstan:2.0.xfrom
xificurk wants to merge 1 commit intophpstan:2.0.xfrom
Conversation
f7f32f1 to
56efd04
Compare
Replace the expensive `reflectClass('...ServiceEntityRepository')` call with a
cheap `InstalledVersions::getVersion('doctrine/doctrine-bundle')` + `version_compare`
check. LazyServiceEntityRepository became ServiceEntityRepository's parent in
DoctrineBundle 2.8.1, so the version threshold is exact.
Add StubFilesExtensionLoaderTest with ThrowingSourceLocator registered as
`betterReflectionSourceLocator` in the test container — any future attempt to
re-introduce reflectClass() in getFiles() will immediately throw.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56efd04 to
27635c4
Compare
| return false; | ||
| } | ||
|
|
||
| return version_compare($bundleVersion, '2.8.1', '>=') && version_compare($bundleVersion, '3.0.0', '<'); |
Contributor
There was a problem hiding this comment.
Given the fact we're only testing doctrine/orm 16+
phpstan-doctrine/composer.json
Line 30 in 8af50e2
I was wondering about updating the conflict section
phpstan-doctrine/composer.json
Line 17 in 8af50e2
WDYT @staabm ?
This way this method would only become isInstalledVersion(doctrine/bundle, 2)
Contributor
There was a problem hiding this comment.
doctrine/orm 16+
you mean 2.16+ I guess?
I was wondering about updating the conflict section
how would you change it? it seems the "doctrine/orm": "<2.5", constraints exists for over 10 years in this extensiions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the expensive
reflectClass('...ServiceEntityRepository')call with a cheapInstalledVersions::getVersion('doctrine/doctrine-bundle')+version_comparecheck. LazyServiceEntityRepository became ServiceEntityRepository's parent in DoctrineBundle 2.8.1 and was removed in 3.0.0, so the version threshold is exact.Add StubFilesExtensionLoaderTest with ThrowingSourceLocator registered as
betterReflectionSourceLocatorin the test container — any future attempt to re-introduce reflectClass() in getFiles() will immediately throw.--
Related:
phpstan/phpstan-src#5577
phpstan/phpstan-src#5538 (comment)