Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no_useless_concat_operator - do not break variable #7827

Merged

Conversation

tamiroh
Copy link
Contributor

@tamiroh tamiroh commented Feb 7, 2024

Fixes #7826

@tamiroh tamiroh changed the title fix: no_useless_concat_operator fix: no_useless_concat_operator - do not break variable Feb 7, 2024
@coveralls
Copy link

coveralls commented Feb 7, 2024

Coverage Status

coverage: 96.028%. remained the same
when pulling 7219dea on tamiroh:fix-no-useless-concat-operator-fixer
into 291fdbf on PHP-CS-Fixer:master.

@kubawerlos kubawerlos mentioned this pull request Feb 7, 2024
@tamiroh tamiroh marked this pull request as ready for review February 8, 2024 09:38
@tamiroh
Copy link
Contributor Author

tamiroh commented Feb 23, 2024

@Wirone @julienfalque
Could you please review this pull request again? 🙏
I think I've done everything I need to do.

Comment on lines +345 to +348
$allowedPatternsForSecondOperand = [
'/^\s.*/', // e.g. " foo", ' bar', " $baz"
'/^-(?!\>)/', // e.g. "-foo", '-bar', "-$baz"
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will allow merging strings in less cases than would technically be possible but I'm guessing this will actually be very rare so good enough for me, we'll improve this later if needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can always think about making regexes configurable, so people can fine-tune this behaviour on their side 🙂.

@Wirone Wirone enabled auto-merge (squash) March 11, 2024 09:44
@Wirone
Copy link
Member

Wirone commented Mar 11, 2024

I took a brief look on a diff, but mostly I rely on @julienfalque's review here - let's merge 👍.

@Wirone Wirone merged commit b52108e into PHP-CS-Fixer:master Mar 11, 2024
24 checks passed
@tamiroh tamiroh deleted the fix-no-useless-concat-operator-fixer branch March 11, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no_useless_concat_operator rule may break code
5 participants