Skip to content

Commit 142f3ec

Browse files
dev: add PHPStan set to level 6 & baseline (#1228)
1 parent 0ce525a commit 142f3ec

File tree

7 files changed

+5667
-7
lines changed

7 files changed

+5667
-7
lines changed

.distignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ cypress.json
2929
docker-compose.ci.yml
3030
CONTRIBUTING.md
3131
artifacts
32+
phpstan.neon
33+
phpstan-baseline.neon

.github/workflows/test-php.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,20 @@ jobs:
5151
composer install --prefer-dist --no-progress --no-dev
5252
- name: Run phpunit
5353
run: phpunit
54+
55+
phpstan:
56+
name: PHPStan
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Setup PHP version
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: "7.4"
63+
extensions: simplexml
64+
- name: Checkout source code
65+
uses: actions/checkout@v4
66+
- name: Install composer
67+
run: |
68+
composer install --prefer-dist --no-progress
69+
- name: Run phpstan
70+
run: composer run phpstan

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
},
3333
"scripts": {
3434
"format": "phpcbf --standard=phpcs.xml --report-summary --report-source",
35-
"lint": "phpcs --standard=phpcs.xml"
35+
"lint": "phpcs --standard=phpcs.xml",
36+
"phpstan": "phpstan",
37+
"phpstan:generate:baseline": "phpstan --generate-baseline"
3638
},
3739
"minimum-stability": "dev",
3840
"prefer-stable": true,
@@ -48,6 +50,8 @@
4850
"require-dev": {
4951
"wp-coding-standards/wpcs": "^2.3",
5052
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
51-
"phpcompatibility/phpcompatibility-wp": "*"
53+
"phpcompatibility/phpcompatibility-wp": "*",
54+
"phpstan/phpstan": "^2.1",
55+
"szepeviktor/phpstan-wordpress": "^2.0"
5256
}
5357
}

composer.lock

Lines changed: 176 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)