Skip to content

Do not crash on first-class callables or missing args in getStorage() - #1026

Merged
mglaman merged 1 commit into
mainfrom
audit/1-correctness-fixes
Aug 5, 2026
Merged

Do not crash on first-class callables or missing args in getStorage()#1026
mglaman merged 1 commit into
mainfrom
audit/1-correctness-fixes

Conversation

@mglaman

@mglaman mglaman commented Aug 5, 2026

Copy link
Copy Markdown
Owner

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 a ShouldNotHappenException, and a zero-argument getStorage() 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 ?Type migration later in the stack (#1027); the full suite, self-analysis, and phpcs are green on this layer.

🤖 Generated with Claude Code

@mglaman mglaman mentioned this pull request Aug 5, 2026
@mglaman
mglaman changed the base branch from main to audit/0-ci-lint-fix August 5, 2026 16:43
@mglaman
mglaman force-pushed the audit/1-correctness-fixes branch from 1494240 to f48dad4 Compare August 5, 2026 16:43
@mglaman mglaman changed the title audit/1 correctness fixes Do not crash on first-class callables or missing args in getStorage() Aug 5, 2026
Base automatically changed from audit/0-ci-lint-fix to main August 5, 2026 17:15
… 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
mglaman force-pushed the audit/1-correctness-fixes branch from f48dad4 to f313a65 Compare August 5, 2026 17:15
@mglaman
mglaman marked this pull request as ready for review August 5, 2026 17:21
@mglaman
mglaman merged commit eb64316 into main Aug 5, 2026
19 of 20 checks passed
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.

1 participant