Repository navigation
Remove PHPStan 1 throw statement handling from two architecture rules - #170
Merged
Merged
Conversation
3 of 5 tasks
schlessera
added a commit
to mwpd/content-freshness
that referenced
this pull request
Oct 23, 2026
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.
Closes #169
What changed
ExceptionsKeepCauseRuleandThrowOnlyPluginExceptionsRuleno longer handlePhpParser\Node\Stmt\Throw_, the throw node of PHP-Parser 4 that only PHPStan 1 produced, and the comments explaining the PHPStan 1 form are gone. Since onlyExpr\Throw_is left,ThrowOnlyPluginExceptionsRulenow listens to that node type instead of everyNode. What the rules report is unchanged. The manifest and docs did not mention the node type, so they needed no change.Why this shape
The issue allowed narrowing the node type "if the rule tests still pass". They do, unchanged, so I took it: it removes the instanceof check and states what the rule inspects.
Proof
Not a fix, so there is no failing-first test; the existing rule tests pass unchanged. Scratch-copy check (in
/tmp, nothing committed,composer.lockuntouched): in a copy of the branch I removedvimeo/psalm,psalm/plugin-phpunitandhumanmade/psalm-plugin-wordpressfromcomposer.jsonand rancomposer update nikic/php-parser vimeo/psalm psalm/plugin-phpunit humanmade/psalm-plugin-wordpress -W --ignore-platform-reqs, which movednikic/php-parserv4.19.5 to v5.9.0. Then, on PHP 8.3.36 (php:8.3-cli):origin/main: 7 errors mentioningThrow_, matching the issue.[OK] No errors.On the committed lock, on PHP 8.3.36 in
php:8.3-cli:Checklist
composer testandcomposer lintpass locally, and CI is green on the current head.breakingand a ruling.Anything left open
Nothing.