Skip to content

Commit 57949f6

Browse files
authored
PHP 8.2 support
* Check PHP 8.2 compatibility * Add psalm to static analysis
1 parent 0648f3d commit 57949f6

File tree

12 files changed

+146
-23
lines changed

12 files changed

+146
-23
lines changed

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Exclude files that don't need to be present in packages (so they're not downloaded by Composer)
2+
.editorconfig export-ignore
3+
.gitattributes export-ignore
4+
/.github/ export-ignore
5+
.gitignore export-ignore
6+
.php-cs-fixer.dist.php export-ignore
7+
codeception.yml export-ignore
8+
/Makefile export-ignore
9+
/phpstan.neon.dist export-ignore
10+
/psalm.xml export-ignore
11+
/test/ export-ignore
12+
/vendor-bin/ export-ignore

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
max-parallel: 10
1111
matrix:
12-
php: [ '8.0', '8.1' ]
12+
php: [ '8.0', '8.1', '8.2' ]
1313

1414
steps:
1515
- name: Set up PHP
@@ -20,10 +20,10 @@ jobs:
2020
tools: composer:v2
2121

2222
- name: Checkout code
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2424

2525
- name: Download dependencies
2626
run: composer update --no-interaction --prefer-dist
2727

2828
- name: Run tests
29-
run: make test
29+
run: make tests

.github/workflows/static-analysis.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,65 @@ jobs:
99

1010
steps:
1111
- name: Checkout code
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313

14-
- name: PHPStan
15-
uses: docker://oskarstark/phpstan-ga:1.4.6
16-
env:
17-
REQUIRE_DEV: true
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
1816
with:
19-
args: analyze --no-progress
17+
php-version: '8.0'
18+
coverage: none
19+
20+
- name: Download dependencies
21+
run: composer install --no-interaction --no-progress
22+
23+
- name: Download PHPStan
24+
run: composer bin phpstan install --no-interaction --no-progress
25+
26+
- name: Execute PHPStan
27+
run: vendor/bin/phpstan analyze --no-progress
2028

2129
php-cs-fixer:
2230
name: PHP-CS-Fixer
2331
runs-on: ubuntu-latest
2432

2533
steps:
2634
- name: Checkout code
27-
uses: actions/checkout@v2
35+
uses: actions/checkout@v3
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: '8.0'
41+
coverage: none
42+
43+
- name: Download dependencies
44+
run: composer install --no-interaction --no-progress
45+
46+
- name: Download PHP CS Fixer
47+
run: composer bin php-cs-fixer install --no-interaction --no-progress
48+
49+
- name: Execute PHP CS Fixer
50+
run: vendor/bin/php-cs-fixer fix --diff --dry-run
51+
52+
psalm:
53+
name: Psalm
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v3
2859

29-
- name: PHP-CS-Fixer
30-
uses: docker://oskarstark/php-cs-fixer-ga:3.4.0
60+
- name: Setup PHP
61+
uses: shivammathur/setup-php@v2
3162
with:
32-
args: --dry-run --diff
63+
php-version: '8.0'
64+
coverage: none
65+
66+
- name: Download dependencies
67+
run: composer install --no-interaction --no-progress
68+
69+
- name: Download Psalm
70+
run: composer bin psalm install --no-interaction --no-progress
71+
72+
- name: Execute Psalm
73+
run: vendor/bin/psalm.phar --no-progress --output-format=github

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Files
22
.php_cs
33
.php_cs.cache
4-
/composer.lock
4+
composer.lock
55
/phpstan.neon
66
!/test/output/.gitkeep
77

88
# Directories
99
/test/output/*
1010
/test/support/_generated
1111
/vendor
12+
/vendor-bin/**/vendor/

CHANGELOG-4.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [4.1.0] - 2023-03-17
8+
### Added
9+
- PHP 8.2 support
10+
- Additional Psalm static analysis
11+
712
## [4.0.0] - 2022-10-19
813
### Added
914
- Codeception v5 support.

Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
help:
22
@echo "Please use \`make <target>' where <target> is one of"
3-
@echo " test to perform tests."
3+
@echo " tests to perform tests."
44
@echo " coverage to perform tests with code coverage."
55
@echo " static to run phpstan and php-cs-fixer check."
66
@echo " static-phpstan to run phpstan."
7+
@echo " static-psalm to run psalm."
78
@echo " static-cs-check to run php-cs-fixer."
89
@echo " static-cs-fix to run php-cs-fixer, writing the changes."
910

10-
.PHONY: test
11-
test:
11+
tests:
1212
vendor/bin/codecept build
1313
vendor/bin/codecept run
1414

15-
.PHONY: coverage
1615
coverage:
1716
vendor/bin/codecept build
1817
vendor/bin/codecept run --coverage --coverage-xml --coverage-html
1918

20-
.PHONY: static
21-
static: static-phpstan static-cs-check
19+
static: static-phpstan static-psalm static-cs-check
2220

2321
static-phpstan:
24-
docker run --rm -it -e REQUIRE_DEV=true -v ${PWD}:/app -w /app oskarstark/phpstan-ga:0.12.85 analyze $(PHPSTAN_PARAMS)
22+
composer install
23+
composer bin phpstan install
24+
vendor/bin/phpstan analyze $(PHPSTAN_PARAMS)
25+
26+
static-psalm:
27+
composer install
28+
composer bin psalm install
29+
vendor/bin/psalm.phar $(PSALM_PARAMS)
2530

2631
static-cs-fix:
27-
docker run --rm -it -v ${PWD}:/app -w /app oskarstark/php-cs-fixer-ga:2.19.0 --diff-format udiff $(CS_PARAMS)
32+
composer install
33+
composer bin php-cs-fixer install
34+
vendor/bin/php-cs-fixer fix --diff $(CS_PARAMS)
2835

2936
static-cs-check:
3037
$(MAKE) static-cs-fix CS_PARAMS="--dry-run"

composer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"require-dev": {
1919
"ext-json": "*",
20+
"bamarni/composer-bin-plugin": "^1.8",
2021
"codeception/module-asserts": "^3.0",
2122
"codeception/module-rest": "^3.0"
2223
},
@@ -32,6 +33,15 @@
3233
}
3334
},
3435
"config": {
35-
"sort-packages": true
36+
"sort-packages": true,
37+
"allow-plugins": {
38+
"bamarni/composer-bin-plugin": true
39+
}
40+
},
41+
"extra": {
42+
"bamarni-bin": {
43+
"bin-links": true,
44+
"forward-command": false
45+
}
3646
}
3747
}

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
includes:
2+
- vendor-bin/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
3+
14
parameters:
25
level: max
36
checkMissingIterableValueType: false

psalm.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="6"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
>
10+
<projectFiles>
11+
<directory name="src" />
12+
<ignoreFiles>
13+
<directory name="vendor" />
14+
</ignoreFiles>
15+
</projectFiles>
16+
</psalm>

vendor-bin/php-cs-fixer/composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"require-dev": {
3+
"php": "^8.0",
4+
"friendsofphp/php-cs-fixer": "^3.15"
5+
},
6+
"config": {
7+
"preferred-install": "dist"
8+
}
9+
}

vendor-bin/phpstan/composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"require-dev": {
3+
"php": "^8.0",
4+
"phpstan/phpstan": "^1.10",
5+
"phpstan/phpstan-deprecation-rules": "^1.1"
6+
},
7+
"config": {
8+
"preferred-install": "dist"
9+
}
10+
}

vendor-bin/psalm/composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"require-dev": {
3+
"php": "^8.0",
4+
"psalm/phar": "^5.8"
5+
},
6+
"config": {
7+
"preferred-install": "dist"
8+
}
9+
}

0 commit comments

Comments
 (0)