[DX] Add ->withPhpXSets() for PHP 7.4 and lower, improve ->withPreparedSets()#5984
Merged
TomasVotruba merged 6 commits intomainfrom Jun 20, 2024
Merged
[DX] Add ->withPhpXSets() for PHP 7.4 and lower, improve ->withPreparedSets()#5984TomasVotruba merged 6 commits intomainfrom
TomasVotruba merged 6 commits intomainfrom
Conversation
66d345d to
b6dc174
Compare
0293ca5 to
f7b13c6
Compare
samsonasik
reviewed
Jun 20, 2024
samsonasik
reviewed
Jun 20, 2024
samsonasik
reviewed
Jun 20, 2024
cf59c26 to
3836a57
Compare
samsonasik
requested changes
Jun 20, 2024
Member
samsonasik
left a comment
There was a problem hiding this comment.
RemovePhpVersionIdCheckRector should be skipped for Notifier file
Member
Author
|
Ready for next review 👍 :) |
3836a57 to
e02e9d9
Compare
Member
Author
|
Thank you 👏 |
samsonasik
reviewed
Jun 20, 2024
| // suitable for PHP 7.4 and lower, before named args | ||
| public function withPhp53Sets(): self | ||
| { | ||
| Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets'); |
Member
There was a problem hiding this comment.
The warning seems shown multiple times due to parallel:
[WARNING] The "Rector\Configuration\RectorConfigBuilder::withPhp53Sets()"
method is suitable for PHP 7.4 and lower. Use "withPhpSets()" method
instead.
0/99 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
[WARNING] The "Rector\Configuration\RectorConfigBuilder::withPhp53Sets()"
method is suitable for PHP 7.4 and lower. Use "withPhpSets()" method
instead.
[WARNING] The "Rector\Configuration\RectorConfigBuilder::withPhp53Sets()"
method is suitable for PHP 7.4 and lower. Use "withPhpSets()" method
instead.
[WARNING] The "Rector\Configuration\RectorConfigBuilder::withPhp53Sets()"
method is suitable for PHP 7.4 and lower. Use "withPhpSets()" method
instead.
that can't be tweak here, only on ApplicationFileProcessor level, the single warning can be shown...
Also, I am thinking if github workflow uses:
matrix:
php-versions: ['7.4, '8.0']
that may not suit, so probably suggest to use withSets()...
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.
The
withPhpSets()method uses named arguments, available since PHP 8.0.If you use Rector on PHP 7.4 and lower, it can be confusing to use:
❌
That's unreadable and error prone. Once new version or order is changed, it behaves differently.
Instead, this PR introduces clear method API:
✔️
Nice and clear :)
Ideally, the
withPhpSets()should be used without any argument, so it always follows yourcomposer.jsonversion 👍