Skip to content

Commit ac4e282

Browse files
dev: add PHPStan (#480)
1 parent 959b805 commit ac4e282

File tree

6 files changed

+7077
-2
lines changed

6 files changed

+7077
-2
lines changed

.distignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ artifact
2121
composer.json
2222
composer.lock
2323
.idea
24+
phpstan.neon
25+
phpstan-baseline.neon
2426
**/*.css.map
2527
.DS_Store
2628
.gitkeep

.github/workflows/test-php.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,19 @@ jobs:
3030
npm run test:unit:php
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
33+
phpstan:
34+
name: PHPStan
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Setup PHP version
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: "7.4"
41+
extensions: simplexml
42+
- name: Checkout source code
43+
uses: actions/checkout@v4
44+
- name: Install composer
45+
run: |
46+
composer install --no-progress
47+
- name: Run phpstan
48+
run: composer run phpstan

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"homepage": "https://themeisle.com"
1111
}
1212
],
13+
"scripts": {
14+
"phpstan": "phpstan",
15+
"phpstan:generate:baseline": "phpstan --generate-baseline"
16+
},
1317
"minimum-stability": "dev",
1418
"prefer-stable": true,
1519
"config": {
@@ -36,6 +40,10 @@
3640
"require-dev": {
3741
"phpunit/phpunit": "^8.5",
3842
"yoast/phpunit-polyfills": "^2.0",
39-
"codeinwp/phpcs-ruleset": "dev-main"
43+
"codeinwp/phpcs-ruleset": "dev-main",
44+
"phpstan/phpstan": "^1.12",
45+
"szepeviktor/phpstan-wordpress": "^1.3",
46+
"php-stubs/woocommerce-stubs": "^10.1",
47+
"damian-elenbaas/elementor-stubs": "^3.31"
4048
}
4149
}

0 commit comments

Comments
 (0)