Do not crash on first-class callables or missing args in getStorage() - #1026
Merged
Conversation
mglaman
force-pushed
the
audit/1-correctness-fixes
branch
from
August 5, 2026 16:43
1494240 to
f48dad4
Compare
… extension $entityTypeManager->getStorage(...) hit a ShouldNotHappenException and took down the whole analysis. Fall back to the declared return type for first-class callables and zero-argument calls instead of throwing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mglaman
force-pushed
the
audit/1-correctness-fixes
branch
from
August 5, 2026 17:15
f48dad4 to
f313a65
Compare
mglaman
marked this pull request as ready for review
August 5, 2026 17:21
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.
Part 2 of 9 in the legacy-code audit stack (on top of #1033).
What changed
$entityTypeManager->getStorage(...)(first-class callable syntax) crashed the whole analysis with aShouldNotHappenException, and a zero-argumentgetStorage()did the same. Both now fall back to the declared return type: a wrong-arity call is the user's error and PHPStan reports it elsewhere — crashing the analysis is never right.Testing
Covered by a new first-class-callable fixture added with the
?Typemigration later in the stack (#1027); the full suite, self-analysis, and phpcs are green on this layer.🤖 Generated with Claude Code