Skip to content

fix: NoUnneededBracesFixer - do not crash on multiline group import#9160

Merged
kubawerlos merged 4 commits intoPHP-CS-Fixer:masterfrom
icarus94:bugfix/multiline-group-import
Oct 28, 2025
Merged

fix: NoUnneededBracesFixer - do not crash on multiline group import#9160
kubawerlos merged 4 commits intoPHP-CS-Fixer:masterfrom
icarus94:bugfix/multiline-group-import

Conversation

@icarus94
Copy link
Copy Markdown
Contributor

processsing something like:

use NotFoo5\{
    Baz5
};

will turn into:

use NotFoo5\
    Baz5
;

Which will cause [ParseError] syntax error, unexpected identifier "Baz5", expecting "{"
when running CS-Fixer.

@icarus94 icarus94 changed the title bugfix: Add case when multiline group import; fix: Add case when multiline group import; Oct 21, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 21, 2025

Coverage Status

coverage: 94.151%. remained the same
when pulling 8fedaee on icarus94:bugfix/multiline-group-import
into ec5d688 on PHP-CS-Fixer:master.

@icarus94
Copy link
Copy Markdown
Contributor Author

Would say it is related to release v3.89.0 (the #9118)

@icarus94
Copy link
Copy Markdown
Contributor Author

Additional context:
Before release v3.89.0 it would leave:

use NotFoo5\{
    Baz5
};

this ⬆️ code as it is, with the no_unneeded_braces rule.

@icarus94
Copy link
Copy Markdown
Contributor Author

Hi, any updates on this issue?

Comment thread src/Fixer/ControlStructure/NoUnneededBracesFixer.php
@kubawerlos kubawerlos changed the title fix: Add case when multiline group import; fix: NoUnneededBracesFixer - do not crash on multiline group import Oct 28, 2025
@kubawerlos kubawerlos merged commit 722a30e into PHP-CS-Fixer:master Oct 28, 2025
33 checks passed
@kubawerlos
Copy link
Copy Markdown
Member

Thank you @icarus94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants