refactor: upgrade to PHP 8.1 with rector
Description Supersedes #7964
All refactoring will be performed just prior to the release of v4.5.0.
Checklist:
- [x] Securely signed commits
- [ ] Component(s) with PHPDoc blocks, only if necessary or adds value
- [ ] Unit testing, with >80% coverage
- [ ] User guide updated
- [ ] Conforms to style guide
@kenjis I suggest rules ChangeSwitchToMatchRector by Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector
Doesn't it included in LevelSetList::UP_TO_PHP_81?
Doesn't it included in
LevelSetList::UP_TO_PHP_81?
Sorry i didnt read it
@samsonasik When rector is executed on this branch, rector enters an infinite loop, because of the following files:
__DIR__ . '/system/Common.php',
__DIR__ . '/system/Helpers/filesystem_helper.php',
__DIR__ . '/system/Helpers/text_helper.php',
__DIR__ . '/system/Helpers/form_helper.php',
__DIR__ . '/system/Helpers/html_helper.php',
__DIR__ . '/system/Helpers/number_helper.php',
Rector adds too many declare(strict_types=1); lines to them.
Is this a bug?
@kenjis probably, could you create a reproducible at https://getrector.com/demo and report at https://github.com/rectorphp/rector/ ? Thank you.
:wave: Hi, @kenjis!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Ref: Syncing Your Branch
:wave: Hi, @kenjis!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Ref: Syncing Your Branch
@samsonasik These files with too many declare(strict_types=1) are all functions, not class files.
But I cannot make a simple reproducible sample code.
@kenjis the DeclareStrictTypesRector can be skipped if it make too many changes, and create separate PR to enable that?
Actually, the DeclareStrictTypesRector is not part of any set list now, so should not apply the changes except registered, I can't see any addition of declare(strict_types=1) now in github diff
:wave: Hi, @kenjis!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Ref: Syncing Your Branch
:wave: Hi, @kenjis!
We detected conflicts in your PR against the base branch :speak_no_evil:
You may want to sync :arrows_counterclockwise: your branch with upstream!
Ref: Syncing Your Branch
@kenjis could you rebase and retry add DeclareStrictTypesRector, run composer update, and verify if no longer infinite loop on latest rector 1.0.3? Thank you.
@samsonasik Thank you! It worked fine.
[OK] 148 files have been changed by Rector
Dropped https://github.com/codeigniter4/CodeIgniter4/pull/8354/commits/1ecb0491baf78f5c7fa16034f47a0174d05d9a8f