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
Wirone
merged 16 commits into
PHP-CS-Fixer:master
from
tamiroh:fix-no-useless-concat-operator-fixer
Mar 11, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
32838a5
Fix
tamiroh fc37ff0
Merge branch 'master' into fix-no-useless-concat-operator-fixer
tamiroh f3fdd61
Add comment
tamiroh 63e8811
Merge branch 'master' into fix-no-useless-concat-operator-fixer
tamiroh dd9ac1e
Use `@phpstan-type`
tamiroh 8da1a9d
Update logic
tamiroh bdd1ebc
Add more tests
tamiroh b7e764c
Add more tests (fails currently)
tamiroh bcfad3e
Fix test
tamiroh 5050292
Add tests
tamiroh e4d7dc3
Revert "Update logic"
tamiroh 3b0e1a6
Use white-list approach
tamiroh 9dbf38b
Fix typo
tamiroh fff0ee4
Format
tamiroh 28edf77
Update priority
tamiroh 7219dea
Merge branch 'master' into fix-no-useless-concat-operator-fixer
Wirone File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
13 changes: 13 additions & 0 deletions
13
tests/Fixtures/Integration/priority/explicit_string_variable,no_useless_concat_operator.test
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--TEST-- | ||
Integration of fixers: explicit_string_variable,no_useless_concat_operator. | ||
--RULESET-- | ||
{"no_useless_concat_operator": true, "explicit_string_variable": true} | ||
--EXPECT-- | ||
<?php | ||
|
||
$foo = "bar {$baz}qux"; | ||
|
||
--INPUT-- | ||
<?php | ||
|
||
$foo = "bar $baz" . "qux"; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙂.