From 56cf10a298aed70021eff16e4a783cdf79c50264 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Thu, 8 Feb 2024 11:01:46 +0300 Subject: [PATCH] Raise minimal PHP version to 8.1 (#134) --- .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/workflows/bc.yml_ | 40 ++++++++++++++----- .github/workflows/build.yml | 3 +- .../workflows/composer-require-checker.yml | 3 +- .github/workflows/mutation.yml | 3 +- .github/workflows/rector.yml | 2 +- .github/workflows/static.yml | 3 +- composer.json | 8 ++-- psalm.xml | 7 +++- rector.php | 6 ++- 10 files changed, 53 insertions(+), 23 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4a3e8ace9..6be5d5871 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,4 +3,3 @@ | Is bugfix? | ✔️/❌ | New feature? | ✔️/❌ | Breaks BC? | ✔️/❌ -| Fixed issues | comma-separated list of tickets # fixed by the PR, if any diff --git a/.github/workflows/bc.yml_ b/.github/workflows/bc.yml_ index 35b3a8624..00041a9f4 100644 --- a/.github/workflows/bc.yml_ +++ b/.github/workflows/bc.yml_ @@ -1,15 +1,33 @@ on: - - pull_request - - push + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' + push: + branches: ['master'] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' name: backwards compatibility + jobs: - roave_bc_check: - name: Roave BC Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: fetch tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - name: Roave BC Check - uses: docker://nyholm/roave-bc-check-ga + roave_bc_check: + uses: yiisoft/actions/.github/workflows/bc.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.1'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed9a60bf6..3feaeef39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -28,4 +29,4 @@ jobs: os: >- ['ubuntu-latest', 'windows-latest'] php: >- - ['8.0', '8.1', '8.2'] + ['8.1', '8.2', '8.3'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index ae5893f54..a857bce6c 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -11,6 +11,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -30,4 +31,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1'] + ['8.1', '8.2', '8.3'] diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index c1aca98cf..a6873e2ee 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -9,6 +9,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -26,6 +27,6 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1'] + ['8.3'] secrets: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index b5a564913..35411d0ae 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -20,4 +20,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0'] + ['8.3'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index fb7fc77dd..e33eca865 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -10,6 +10,7 @@ on: - 'phpunit.xml.dist' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -28,4 +29,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1', '8.2'] + ['8.1', '8.2', '8.3'] diff --git a/composer.json b/composer.json index 44b68b315..3afbb35ac 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "yiisoft/yii-bootstrap": "1.0" }, "require": { - "php": "^8.0", + "php": "^8.1", "yiisoft/arrays": "^1.0|^2.0|^3.0", "yiisoft/assets": "^4.0", "yiisoft/files": "^2.0", @@ -29,11 +29,11 @@ }, "require-dev": { "maglnet/composer-require-checker": "^4.3", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.19.0", + "phpunit/phpunit": "^9.6", + "rector/rector": "^0.19.8", "roave/infection-static-analysis-plugin": "^1.16", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.30|^5.13", + "vimeo/psalm": "^5.21", "yiisoft/aliases": "^3.0", "yiisoft/di": "^1.0" }, diff --git a/psalm.xml b/psalm.xml index 4e9226bdb..2a2f7e560 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,8 @@ + + + + diff --git a/rector.php b/rector.php index f55daaed4..90fea6ba9 100644 --- a/rector.php +++ b/rector.php @@ -4,7 +4,9 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; +use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { @@ -18,10 +20,12 @@ // define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, + LevelSetList::UP_TO_PHP_81, ]); $rectorConfig->skip([ ClosureToArrowFunctionRector::class, + JsonThrowOnErrorRector::class, + ReadOnlyPropertyRector::class, ]); };