Skip to content

Commit

Permalink
Upgrade PHP version to 8.1. (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 29, 2024
1 parent f444a25 commit 3cf3905
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -29,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2']
['8.1', '8.2', '8.3']
58 changes: 9 additions & 49 deletions .github/workflows/static.yml
Expand Up @@ -4,8 +4,8 @@ on:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.env.example'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
Expand All @@ -15,60 +15,20 @@ on:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.env.example'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

schedule:
- cron: '0 0 * * *'

name: static analysis

jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
- ubuntu-latest

php:
- "8.0"
- "8.1"
- "8.2"

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2, cs2pr
coverage: none

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
psalm:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
- name: Static analysis
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -28,7 +28,7 @@
]
},
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-intl": "*",
"httpsoft/http-message": "^1.1",
"psr/container": "^2.0",
Expand Down Expand Up @@ -75,10 +75,10 @@
"codeception/module-phpbrowser": "^3.0",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.19.0",
"roave/infection-static-analysis-plugin": "^1.25",
"roave/infection-static-analysis-plugin": "^1.34",
"roave/security-advisories": "dev-master",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.4",
"vimeo/psalm": "^5.20",
"yiisoft/yii-debug-api": "3.0.x-dev",
"yiisoft/yii-debug-viewer": "^3.0@dev",
"yiisoft/yii-testing": "dev-master"
Expand Down
13 changes: 10 additions & 3 deletions psalm.xml
@@ -1,16 +1,23 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<directory name="src" />
<file name="public/index.php"/>
<file name="yii"/>
<file name="autoload.php"/>
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RiskyTruthyFalsyComparison errorLevel="suppress" />
</issueHandlers>
</psalm>

11 changes: 10 additions & 1 deletion rector.php
Expand Up @@ -4,6 +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 {
Expand All @@ -17,6 +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,
]);
};

0 comments on commit 3cf3905

Please sign in to comment.