Skip to content

Commit 2c21f65

Browse files
authored
PHP 8.4 support (#276)
1 parent 48feceb commit 2c21f65

File tree

10 files changed

+57
-94
lines changed

10 files changed

+57
-94
lines changed

.github/workflows/bc.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
on:
2-
- pull_request
3-
- push
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'phpunit.xml.dist'
11+
- 'psalm.xml'
12+
push:
13+
branches: ['master']
14+
paths-ignore:
15+
- 'docs/**'
16+
- 'README.md'
17+
- 'CHANGELOG.md'
18+
- '.gitignore'
19+
- '.gitattributes'
20+
- 'infection.json.dist'
21+
- 'phpunit.xml.dist'
22+
- 'psalm.xml'
423

524
name: backwards compatibility
625

726
jobs:
827
roave_bc_check:
928
uses: yiisoft/actions/.github/workflows/bc.yml@master
1029
with:
11-
extensions: uopz
1230
os: >-
1331
['ubuntu-latest']
1432
php: >-
15-
['8.3']
33+
['8.4']

.github/workflows/build.yml

Lines changed: 9 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'psalm.xml'
1111

1212
push:
13+
branches: ['master']
1314
paths-ignore:
1415
- 'docs/**'
1516
- 'README.md'
@@ -23,68 +24,11 @@ name: build
2324

2425
jobs:
2526
phpunit:
26-
name: PHP ${{ matrix.php }}-${{ matrix.os }}
27-
28-
runs-on: ${{ matrix.os }}
29-
30-
strategy:
31-
matrix:
32-
os:
33-
- ubuntu-latest
34-
- windows-latest
35-
36-
php:
37-
- 8.1
38-
- 8.2
39-
- 8.3
40-
41-
exclude:
42-
- os: windows-latest
43-
php: 8.2
44-
45-
- os: windows-latest
46-
php: 8.3
47-
48-
steps:
49-
- name: Checkout.
50-
uses: actions/checkout@v3
51-
52-
- name: Install PHP with extensions.
53-
uses: shivammathur/setup-php@v2
54-
with:
55-
coverage: pcov
56-
extensions: uopz
57-
ini-values: date.timezone='UTC'
58-
php-version: ${{ matrix.php }}
59-
tools: composer:v2
60-
61-
- name: Determine composer cache directory on Linux.
62-
if: matrix.os == 'ubuntu-latest'
63-
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
64-
65-
- name: Determine composer cache directory on Windows.
66-
if: matrix.os == 'windows-latest'
67-
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
68-
69-
- name: Cache dependencies installed with composer.
70-
uses: actions/cache@v3
71-
with:
72-
path: ${{ env.COMPOSER_CACHE_DIR }}
73-
key: php${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
74-
restore-keys: |
75-
php${{ matrix.php }}-composer-
76-
77-
- name: Update composer.
78-
run: composer self-update
79-
80-
- name: Install dependencies with composer.
81-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
82-
83-
- name: Run tests with phpunit with code coverage.
84-
run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always --configuration phpunit.xml.dist
85-
86-
- name: Upload coverage to Codecov.
87-
if: matrix.os == 'ubuntu-latest'
88-
uses: codecov/codecov-action@v3
89-
with:
90-
files: ./coverage.xml
27+
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
28+
secrets:
29+
codecovToken: ${{ secrets.CODECOV_TOKEN }}
30+
with:
31+
os: >-
32+
['ubuntu-latest', 'windows-latest']
33+
php: >-
34+
['8.1', '8.2', '8.3', '8.4']

.github/workflows/composer-require-checker.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ jobs:
3131
os: >-
3232
['ubuntu-latest']
3333
php: >-
34-
['8.3']
35-
extensions: uopz
34+
['8.1', '8.2', '8.3', '8.4']

.github/workflows/mutation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- 'psalm.xml'
1010

1111
push:
12+
branches: ['master']
1213
paths-ignore:
1314
- 'docs/**'
1415
- 'README.md'
@@ -27,7 +28,6 @@ jobs:
2728
['ubuntu-latest']
2829
php: >-
2930
['8.3']
30-
extensions: uopz
3131
min-covered-msi: 100
3232
secrets:
3333
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

.github/workflows/rector.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
on:
2-
pull_request:
2+
pull_request_target:
33
paths-ignore:
44
- 'docs/**'
55
- 'README.md'
@@ -14,9 +14,11 @@ name: rector
1414
jobs:
1515
rector:
1616
uses: yiisoft/actions/.github/workflows/rector.yml@master
17+
secrets:
18+
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
1719
with:
20+
repository: ${{ github.event.pull_request.head.repo.full_name }}
1821
os: >-
1922
['ubuntu-latest']
2023
php: >-
21-
['8.3']
22-
extensions: uopz
24+
['8.4']

.github/workflows/static.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@ jobs:
3030
os: >-
3131
['ubuntu-latest']
3232
php: >-
33-
['8.1', '8.2', '8.3']
34-
extensions: uopz
33+
['8.1', '8.2', '8.3', '8.4']

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Bug #264: Fix bug when default roles were not checked in `Manager::userHasPermission()` (@KovYu, @arogachev)
66
- New #275: Add optional `$clock` parameter to `Manager` constructor to get current time (@vjik)
7+
- Chg #276: Change PHP constraint in `composer.json` to `8.1 - 8.4` (@vjik)
78

89
## 2.0.0 March 07, 2024
910

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
}
2828
],
2929
"require": {
30-
"php": "^8.1",
30+
"php": "8.1 - 8.4",
3131
"yiisoft/access": "2.0",
3232
"yiisoft/friendly-exception": "^1.1"
3333
},
@@ -38,7 +38,7 @@
3838
"rector/rector": "^2.0.10",
3939
"roave/infection-static-analysis-plugin": "^1.35",
4040
"spatie/phpunit-watcher": "^1.24",
41-
"vimeo/psalm": "^5.26.1",
41+
"vimeo/psalm": "^5.26.1 || ^6.9.2",
4242
"yiisoft/di": "^1.3"
4343
},
4444
"suggest": {

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
errorLevel="1"
44
findUnusedBaselineEntry="true"
55
findUnusedCode="false"
6+
ensureOverrideAttribute="false"
67
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
78
xmlns="https://getpsalm.org/schema/config"
89
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

rector.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,22 @@
55
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
66
use Rector\Config\RectorConfig;
77
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
8-
use Rector\Set\ValueObject\LevelSetList;
8+
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
9+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
10+
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
911

10-
return static function (RectorConfig $rectorConfig): void {
11-
$rectorConfig->paths([
12+
return RectorConfig::configure()
13+
->withPaths([
1214
__DIR__ . '/src',
1315
__DIR__ . '/tests',
14-
]);
15-
16-
// register a single rule
17-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
18-
19-
// define sets of rules
20-
$rectorConfig->sets([
21-
LevelSetList::UP_TO_PHP_80,
22-
]);
23-
24-
$rectorConfig->skip([
16+
])
17+
->withPhpSets(php81: true)
18+
->withRules([
19+
InlineConstructorDefaultToPropertyRector::class,
20+
])
21+
->withSkip([
2522
ClosureToArrowFunctionRector::class,
23+
ReadOnlyPropertyRector::class,
24+
NullToStrictStringFuncCallArgRector::class,
25+
NewInInitializerRector::class,
2626
]);
27-
};

0 commit comments

Comments
 (0)