Fix DocBlockTagGrouping reporting a fix it never applied - #74
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a logic inversion in DocBlockTagGroupingSniff::checkBeginningOfDocBlock() that caused PHPCBF to report NoExtraNewlineBeforeTags as fixable but skip applying the actual fix, and updates the corresponding smoke fixture output to reflect the now-applied change.
Changes:
- Correct the fixable-error guard in
checkBeginningOfDocBlock()by switching fromif ($fix) { return; }toif (!$fix) { return; }. - Update the
DocBlockTagGrouping“after” fixture to remove the extra blank*line before tags, matching the fixed behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
PhpCollective/Sniffs/Commenting/DocBlockTagGroupingSniff.php |
Fixes the inverted fixer guard so the changeset runs only when fixing is enabled. |
tests/_data/DocBlockTagGrouping/after.php |
Updates expected fixed output to reflect removal of the extra blank line before the first tag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
checkBeginningOfDocBlock() returned as soon as addFixableError() came back true, so the fixer body ran only when the fixer was switched off. phpcbf listed NoExtraNewlineBeforeTags as fixable and then left the blank line in place, every time. Every other fixable error in the file guards with `if (!$fix)`. This one had the condition inverted. The fixture added with the smoke tests recorded the broken output; it now records the blank line actually being removed.
dereuromark
force-pushed
the
docblock-taggrouping-unfixed-error
branch
from
August 6, 2026 11:31
143209e to
b671e1e
Compare
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.
checkBeginningOfDocBlock()guarded its fixer body with the condition inverted:addFixableError()returns true only while the fixer is running. So the changeset ran only when the fixer was disabled - a no-op - and phpcbf reportedNoExtraNewlineBeforeTagsas fixable and then changed nothing. Every other fixable error in the file usesif (!$fix) { return; }.Found while writing the smoke fixtures in #73, which recorded the broken output:
The fixture now records the blank line actually being removed.