Skip to content

Commit 9e6d455

Browse files
committed
Migrate to PHPStan
1 parent d41d511 commit 9e6d455

File tree

5 files changed

+22
-84
lines changed

5 files changed

+22
-84
lines changed

.github/workflows/php.yml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ jobs:
5050
uses: shivammathur/setup-php@v2
5151
with:
5252
# Should be the higest supported version, so we can use the newest tools
53-
php-version: '8.3'
54-
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
55-
# optional performance gain for psalm: opcache
56-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, pdo, posix, spl, xml
53+
php-version: '8.4'
54+
tools: composer, composer-require-checker, composer-unused, phpcs, phpstan
55+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml
5756

5857
- name: Setup problem matchers for PHP
5958
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
@@ -85,27 +84,13 @@ jobs:
8584
- name: PHP Code Sniffer
8685
run: phpcs
8786

88-
- name: Psalm
89-
continue-on-error: true
90-
run: |
91-
psalm -c psalm.xml \
92-
--show-info=true \
93-
--shepherd \
94-
--php-version=${{ steps.setup-php.outputs.php-version }}
95-
96-
- name: Psalm (testsuite)
87+
- name: PHPStan
9788
run: |
98-
psalm -c psalm-dev.xml \
99-
--show-info=true \
100-
--shepherd \
101-
--php-version=${{ steps.setup-php.outputs.php-version }}
89+
vendor/bin/phpstan analyze -c phpstan.neon --debug
10290
103-
- name: Psalter
91+
- name: PHPStan (testsuite)
10492
run: |
105-
psalm --alter \
106-
--issues=UnnecessaryVarAnnotation \
107-
--dry-run \
108-
--php-version=${{ steps.setup-php.outputs.php-version }}
93+
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
10994
11095
security:
11196
name: Security checks
@@ -156,7 +141,7 @@ jobs:
156141
fail-fast: false
157142
matrix:
158143
operating-system: [ubuntu-latest]
159-
php-versions: ['8.1', '8.2', '8.3']
144+
php-versions: ['8.1', '8.2', '8.3', '8.4']
160145

161146
steps:
162147
- name: Setup PHP, with composer and extensions
@@ -196,15 +181,15 @@ jobs:
196181
run: composer install --no-progress --prefer-dist --optimize-autoloader
197182

198183
- name: Run unit tests with coverage
199-
if: ${{ matrix.php-versions == '8.3' }}
184+
if: ${{ matrix.php-versions == '8.4' }}
200185
run: vendor/bin/phpunit
201186

202187
- name: Run unit tests (no coverage)
203-
if: ${{ matrix.php-versions != '8.3' }}
188+
if: ${{ matrix.php-versions != '8.4' }}
204189
run: vendor/bin/phpunit --no-coverage
205190

206191
- name: Save coverage data
207-
if: ${{ matrix.php-versions == '8.3' }}
192+
if: ${{ matrix.php-versions == '8.4' }}
208193
uses: actions/upload-artifact@v4
209194
with:
210195
name: coverage-data
@@ -218,7 +203,7 @@ jobs:
218203
fail-fast: true
219204
matrix:
220205
operating-system: [windows-latest]
221-
php-versions: ['8.1', '8.2', '8.3']
206+
php-versions: ['8.1', '8.2', '8.3', '8.4']
222207

223208
steps:
224209
- name: Setup PHP, with composer and extensions

phpstan-dev.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 9
3+
paths:
4+
- tests

phpstan.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
level: 5
3+
paths:
4+
- src
5+
includes:
6+
- phpstan-baseline.neon

psalm-dev.xml

Lines changed: 0 additions & 27 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)