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

chore: add cs-fixer v3 #290

Merged
merged 2 commits into from
Aug 27, 2024
Merged

chore: add cs-fixer v3 #290

merged 2 commits into from
Aug 27, 2024

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jul 29, 2024

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 the nullable_type_declaration check into it.
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.

@phil-davis phil-davis self-assigned this Jul 29, 2024
@phil-davis phil-davis requested a review from staabm July 29, 2024 09:14
@phil-davis phil-davis marked this pull request as ready for review July 29, 2024 09:14
@phil-davis
Copy link
Contributor Author

I have confirmed locally with PHP 8.4 that if a remove the ? from a parameter declaration like
?array $elementMap = null
then run cs-fixer,
it finds the problem and puts the ? back - good.

@phil-davis phil-davis merged commit 8366747 into sabre-io:2.2 Aug 27, 2024
9 checks passed
@phil-davis phil-davis deleted the add-cs-fixer-v3 branch August 27, 2024 09:07
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.

1 participant