-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PHP 8.0 support #4702
Comments
Union Types rule should definitely support sorting to prevent |
Note that this issue is not about implementing new rules but making sure that existing rules do not break with new PHP 8.0 syntax changes. Nice suggestion though 👍 |
More changes to the lexer: sebastianbergmann/php-token-stream#95. (php/php-src#5182) |
@SpacePossum that RFC has been rejected. Voting closed yesterday, and they failed to get a 2/3 majority (only managed 58.9%). |
@GrahamCampbell can you link the RFC? php/php-src#5182 appears to be accepted and merged (despite the closed PR status). |
Would a dedicated Travis CI job for PHP 8.0 be a part of the definition of done for this issue? I know there is a nightly builds job, but that differs from pointing to a release of PHP 8.0 (even if it is beta). |
If Travis CI supports dedicated PHP 8.0 jobs, I would say yes. |
#5114 gets us started with some stuff. If anyone could work out why that\s not working, that'd be a help. |
PHP 8.0 Wiki Page and Timetable - GA Release 11/26/2020 PHP 8.0.0RC1 Upgrade Notes - information on new features and backwards-incompatible changes. Implemented RFCs for 8.0 - a good place to learn of language changes that would most affect this project |
I took some time to review all the core changes in the upgrade notes and their respective RFCs. I picked out the ones that had syntax changes, or I otherwise felt might break a rule. I created a Google Sheet to track these potentially rule-breaking changes. Anyone can comment on this sheet. Please request edit permissions if desired: removed link to avoid confusion This is just a quick-and-dirty organization technique for myself that I thought would be useful; if there is a better place to organize this (like in this GitHub issue description?) let me know. Edit: PHPCompatibility has a nice checklist of changes as well. I also like how they organized the tasks. |
@hamdrew To be honest I prefer tracking PHP changes here, I updated the description. Hopefully I didn't forget anything important. |
@julienfalque I agree! I removed the link to avoid confusion. Last night I set up a PHP 8 docker environment to develop from. I share it here if anyone finds it useful: https://github.com/hamdrew/PHP-CS-Fixer-Docker I didn't want to contribute a docker development environment directly to this project because that is a large discussion that doesn't need to happen right now. |
This commit addresses the following PHP8 backwards-incompatible change: > SplFixedArray is now an IteratorAggregate and not an Iterator. SplFixedArray::rewind(), ::current(), ::key(), ::next(), and ::valid() have been removed. In their place, SplFixedArray::getIterator() has been added. Any code which uses explicit iteration over SplFixedArray must now obtain an Iterator through SplFixedArray::getIterator(). This means that SplFixedArray is now safe to use in nested loops. Addresses PHP-CS-Fixer#4702
I addressed the SplFixedArray issue first in #5167, since it was prohibiting a lot of tests from running. @SpacePossum To what branch would you like php8-related PRs to be targeted? I chose master for now. |
@SpacePossum Cool, I'll target the same branch in my PRs to be consistent. |
This commit addresses the following PHP8 backwards-incompatible change: > SplFixedArray is now an IteratorAggregate and not an Iterator. SplFixedArray::rewind(), ::current(), ::key(), ::next(), and ::valid() have been removed. In their place, SplFixedArray::getIterator() has been added. Any code which uses explicit iteration over SplFixedArray must now obtain an Iterator through SplFixedArray::getIterator(). This means that SplFixedArray is now safe to use in nested loops. Addresses PHP-CS-Fixer#4702
Related: PHP-CS-Fixer/diff#19. |
Based on the reasoning to not allow usage of the tool in #5341
Would it be an idea to give the user a warning when someone uses |
or at least the info how to use PHP_IGNORE_ENV. |
@keradus Ah sorry guess I'm getting tired that would be way better 😅 I will add some documentation about |
This PR was squashed before being merged into the 2.17 branch. Discussion ---------- Add PHP8 integration test ref #4702 There are ~3~ 4 cases still crashing in the spec files: - [x] nullsafe operator -> PHP 8.0.1 to be released at 7th - [x] attributes #5406 - [x] union types for method parameters #5405 - [x] union types for class properties #5439 I also found the following issues that I raised as separated PRs: - [x] ~#5396~ -> #5397 - [x] ~#5400~ -> #5404 Commits ------- 324929f Add PHP8 integration test
2.18 with PHP8 enabled was released. If you would spot any issues with it, raise a new ticket. I'm leaving this meta-ticket open, as it still contains plenty of ideas for new rules. |
I'm going to close here as a lot of work has been done and having new dedicated |
Syntax changes that require new tests to make sure the tool is compatible with PHP 8.0:
update existing codeupdate existing code(PHP8 - Allow trailing comma in parameter list support #5240 PHP8 - Allow trailing comma in parameter list support #5239)update existing codeupdate existing codeupdate existing codeupdate existing codenew feature(already implemented)update existing codenew feature(already implemented)update existing codeupdate existing codeupdate existing codeupdate existing codenew feature(already implemented)update existing codenew feature(not we can do)update existing codenew feature(already implemented)update existing codenew feature(already implemented)update existing codetests/Fixtures/Integration/misc/PHP8_0.test
) ensuring all new syntaxes are passing complex ruleset like@Symfony
or@PhpCsFixer:risky
) (Add PHP8 integration test #5399)TravisGitHub Actions with dedicated PHP8 jobOther changes that might require fixing existing tests and/or adding new ones:
Object-based token_get_all() alternativeDon't include trailing newline in comment tokenAdditional source: https://github.com/php/php-src/blob/php-8.0.0rc1/UPGRADING
Note
composer.json
of the project will be done after all current functionality has been made compatible (new feature support can wait)nightly
as allowed to fail. When there is a dedicated Travis target for PHP8 we will add it to the stepsThe text was updated successfully, but these errors were encountered: