Fix alter ignoring MissingThrowsDocblock suppression#11586
Fix alter ignoring MissingThrowsDocblock suppression#11586d-mitrofanov-v wants to merge 15 commits intovimeo:6.xfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit c102fb1. Configure here.
| $this->source->getFilePath(), | ||
| $this->function, | ||
| ); | ||
| $manipulator->addThrowsDocblock($missingThrowsDocblockErrors); |
There was a problem hiding this comment.
Suppressed exceptions included in altered throws docblock
Medium Severity
The $missingThrowsDocblockErrors array accumulates ALL non-expected exception names unconditionally (before the suppression check), but addThrowsDocblock passes this full array when any non-suppressed exception triggers the alter path. If exception A is suppressed and exception B is not, processing B will call addThrowsDocblock([A, B]), adding suppressed exception A to the @throws docblock. The suppression check gates whether addThrowsDocblock is called, but doesn't filter the array contents.
Reviewed by Cursor Bugbot for commit c102fb1. Configure here.


Psalter ignored
MissingThrowsDocblocksuppression in config and changed suppressed files anyway.This happened because the check for
isSuppressedwas missing in if statement for$codebase->alter_codeand because check foralter_codewas not insideif (!$is_expected) blockNote
Medium Risk
Changes the conditions under which Psalm’s code-alteration path inserts
@throwsannotations, which can affect automated file rewrites during psalter runs. Risk is moderate because it alters auto-fix behavior but is scoped to theMissingThrowsDocblockfix flow.Overview
Fixes psalter’s
MissingThrowsDocblockauto-fix so it does not modify code when the issue is suppressed. The analyzer now creates a reusableMissingThrowsDocblockissue instance, passes suppression info intoIssueBuffer::maybeAdd, and only callsFunctionDocblockManipulator::addThrowsDocblock()whenalter_codeis enabled, the issue is configured to be fixed, and the specific instance is not suppressed.Also includes a minor whitespace-only adjustment around the
MissingOverrideAttributeauto-fix block.Reviewed by Cursor Bugbot for commit 95034c7. Bugbot is set up for automated code reviews on this repo. Configure here.