chore: allow php-cs-fixer major version 3 #132
Merged
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.
Add the ability to use php-cs-fixer major version 3.
Add
.php-cs-fixer.dist.php
(the settings of php-cs-fixer for major version 3) and put thenullable_type_declaration
check into it. This is the main reason for the PR - it makes sure that any of these that will emit deprecation messages in PHP 8.4, are found in CI.Run cs-fixer on PHP 8.4.
Leave the old cs-fixer still running on PHP 7.1.
And run cs-fixer on every PHP version, to be sure. In CI,
composer
will choose whether to use major version 2 or 3 of php-cs-fixer.The newer cs-fixer v3 makes various nice fixes that do not break on PHP 7.1.
The old cs-fixer v2 is happy with the changes, it does not try to change them back - that is nice.
This is only needed for this old release series that still has PHP 7.1 support. We can run both cs-fixer and phpstan (and phpunit) on PHP 7.1 through 8.4. I think that helps give confidence that the code works across that range of PHP versions.
Note: when I forward-port all this stuff to later major releases, I won't need to do all this tweaking because we move to supporting only PHP 7.4 and up.
Similar to:
sabre-io/xml#290
sabre-io/http#243
sabre-io/uri#117
Note: for php-cs-fixer v3 I also had to set:
Because v2 does it like that, and I couldn't find a way to force v2 to put a blank line between each group of "use" statements.
And define
ordered_imports
for php-cs-fixer v2, so that it works the way that v3 works.That is fine for this 5.1 branch - in the later major release branches I won't need to fine-tune "odd" php-cs-fixer rules.
The "odd" rules were only relevant to
examples/promise.php
- that has ordinaryuse
statements and ause function
statement. So there was no "real" run-time code that was impacted.