Repository navigation
Blink: fix StandaloneLineRequiredParam, BracesPosition, StatementIndentation, MethodArgumentSpace and TrailingCommaInMultiline - #291
Merged
Conversation
Contributor
Author
|
CI here waits for a maintainer's approval, so I ran it on my fork. With the test commit alone, |
Contributor
Author
|
I added two commits that port PHP-CS-Fixer's move of the brace past comments, so the known gap in the description is gone. Failing tests alone, on my fork: https://github.com/GErpeldinger/ecs-src/actions/runs/41905778736. The fix is now pushed. |
The expected output of the tables comes from the PHP engine. The fix follows.
StandaloneLineRequiredParam counted "#[Body(required: true)]" as #[Required] and ran after LineLength. BracesPosition treated "new readonly class" as a named class, and now keeps a brace on its own line after a "//" comment instead of writing it inside the comment. StatementIndentation gets a block for "#[", MethodArgumentSpace keeps the spaces that align comments, and TrailingCommaInMultiline skips destructuring by default.
…t ends The expected output of the tables comes from the PHP engine and token_get_all. The fix follows. The test that kept the brace in place goes away, because the fix moves it like PHP-CS-Fixer.
…iage return
BracesPosition only rewrote the whitespace before the brace, so "if ($b) // c" with the
brace on the next line became "if ($b) // c {", a parse error. Port $moveBraceToIndex.
PHP-CS-Fixer first puts a one-line body on its own line, which blink does for closures
only, so the scan stops at code. Where PHP-CS-Fixer itself writes the brace inside a
comment, on "/*a*/// c", blink keeps the input.
The lexer ended a line comment at "\n" only. PHP stops before "\r" too, so on CRLF files
the "\r" was part of the comment, and with the move the brace could cross real code on a
file with a bare "\r".
TomasVotruba
force-pushed
the
blink-false-reports
branch
from
November 4, 2026 21:22
c5ea1a3 to
7b7f9d5
Compare
Member
|
Thank you 👏 |
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.
Blink reports these where the PHP engine reports nothing, or breaks the code.
StandaloneLineRequiredParam:#[Body(required: true)]counted as#[Required], on public methods.StandaloneLineRequiredParam: it had no priority, so it ran afterLineLength.BracesPosition:new readonly classwas treated as a named class.BracesPosition:if ($b) // cwith{on the next line becameif ($b) // c {, a parse error. This ports PHP-CS-Fixer's move of the brace past comments.\nonly, while PHP stops before\rtoo, so comment rules saw the\ron CRLF files.StatementIndentation:#[opened no block, so a multi-line attribute list got the wrong indent.MethodArgumentSpace: it collapsed the spaces that align comments after a comma.TrailingCommaInMultiline: it added a comma to a multi-line destructuring.Each fix commit follows a commit of failing tests, with expected output from the PHP engine.
One difference on purpose: on
if ($b) /*a*/// cwith{on the next line, PHP-CS-Fixer writes the brace inside the comment, a parse error. Blink keeps the input.🤖 Generated with Claude Code