Repository navigation
Fix analysis errors reported by PHPStan 2.3 - #362
Open
michielgerritsen wants to merge 2 commits into
Open
michielgerritsen wants to merge 2 commits into
michielgerritsen wants to merge 2 commits into
Conversation
CI installs dependencies without a lock file, so every run now gets PHPStan 2.3.x, which reports three errors on untouched master and turns all PR builds red. The PSR-4 loop in ClassLoaderProvider reused the key and value variables of the PSR-0 loop above it (foreach.keyOverwrite). PHPStan 2.3 documents the scope parameter of DynamicMethodReturnTypeExtension::getTypeFromMethodCall() as Scope&DependencyTracker. The test now mocks MutatingScope, which satisfies both there and still works on PHPStan 2.0-2.2, where DependencyTracker does not exist.
Since PHPStan 2.3 "diagnose" reports the turbo extension as loaded by the restart an analyse run performs instead of "enabled", and \PHPStanTurbo\ArenaCache, which the arena probe loaded, no longer exists. The REQUIRE_TURBO guard therefore failed on CI although the analyse run does load turbo. The worker binary PHPStan names, provided it exists on disk, is now the signal on the 2.3 wording; the direct arena probe remains for PHPStan 2.2 and older.
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.
CI installs dependencies without a lock file, so every run now resolves PHPStan 2.3.x, which reports three errors on untouched master and turns every PR build red, including #361. The PSR-4 loop in
ClassLoaderProviderreused the key and value variables of the PSR-0 loop above it; they are now named$psr4Namespace/$psr4Path. PHPStan 2.3 documents the scope parameter ofDynamicMethodReturnTypeExtension::getTypeFromMethodCall()asScope&DependencyTracker, so the extension test now mocksMutatingScope, which satisfies that intersection on 2.3 and still exists on PHPStan 2.0-2.2, whereDependencyTrackerdoes not. Worth a look:MutatingScopeis outside PHPStan's BC promise, but referencingDependencyTrackerdirectly would fatal on the older PHPStan versions composer.json allows. Verified on PHPStan 2.3.6 and 2.2.14:composer analyzeclean, 113 tests green,cs-checkclean.