-
-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduce Rector to upgrade code for PHP 8.1 (#2977)
- Add rector/rector:fix composer scripts and description - Add Rector workflow - Add rector check to GrumPHP
- Loading branch information
Showing
52 changed files
with
370 additions
and
419 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: PHP Rector | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- 2.x | ||
paths: | ||
- '**.php' | ||
- '**composer.json' | ||
pull_request: | ||
branches: | ||
- master | ||
- 2.x | ||
paths: | ||
- '**.php' | ||
- '**composer.json' | ||
types: | ||
- opened | ||
- synchronize | ||
- ready_for_review | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
php-cs: | ||
name: PHP Rector | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/setup | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
|
||
- name: Run Rector checks | ||
if: steps.changed-files.outputs.all_changed_files != '' | ||
run: ./vendor/bin/rector process --dry-run ${{ steps.changed-files.outputs.files }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ grumphp: | |
composer_normalize: ~ | ||
ecs: ~ | ||
phplint: ~ | ||
rector: ~ | ||
# phpstan: | ||
# memory_limit: "-1" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Php80\Rector\Class_\StringableForToStringRector; | ||
use Rector\Php81\Rector\Array_\FirstClassCallableRector; | ||
|
||
return RectorConfig::configure() | ||
->withPaths([ | ||
__DIR__ . '/src', | ||
]) | ||
->withPhpSets( | ||
php81: true, | ||
) | ||
->withPreparedSets( | ||
// deadCode: true, | ||
// codeQuality: true, | ||
// earlyReturn: true, | ||
) | ||
->withSkip([ | ||
FirstClassCallableRector::class, | ||
StringableForToStringRector::class, | ||
]); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.