Skip to content

Commit 301c6ff

Browse files
committed
Add phpstan settings
1 parent 3cab4c5 commit 301c6ff

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

bin/run-phpstan-tests

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
# Run the code style check only if a configuration file exists.
4+
if [ -f "phpstan.dist.neon" ] || [ -f "phpstan.neon.dist" ] || [ -f "phpstan.neon" ]
5+
then
6+
vendor/bin/phpstan analyse "$@"
7+
fi

composer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"php-parallel-lint/php-console-highlighter": "^1.0",
1616
"php-parallel-lint/php-parallel-lint": "^1.3.1",
1717
"phpcompatibility/php-compatibility": "^9.3.5",
18+
"phpstan/extension-installer": "^1.3",
19+
"phpstan/phpstan": "^1.11",
20+
"szepeviktor/phpstan-wordpress": "^1.3",
1821
"wp-cli/config-command": "^1 || ^2",
1922
"wp-cli/core-command": "^1 || ^2",
2023
"wp-cli/eval-command": "^1 || ^2",
@@ -28,7 +31,8 @@
2831
"config": {
2932
"allow-plugins": {
3033
"dealerdirect/phpcodesniffer-composer-installer": true,
31-
"johnpbloch/wordpress-core-installer": true
34+
"johnpbloch/wordpress-core-installer": true,
35+
"phpstan/extension-installer": true
3236
},
3337
"sort-packages": true
3438
},
@@ -62,19 +66,22 @@
6266
"bin/run-linter-tests",
6367
"bin/run-php-unit-tests",
6468
"bin/run-phpcs-tests",
65-
"bin/run-phpcbf-cleanup"
69+
"bin/run-phpcbf-cleanup",
70+
"bin/run-phpstan-tests"
6671
],
6772
"scripts": {
6873
"behat": "run-behat-tests",
6974
"behat-rerun": "rerun-behat-tests",
7075
"lint": "run-linter-tests",
7176
"phpcs": "run-phpcs-tests",
7277
"phpcbf": "run-phpcbf-cleanup",
78+
"phpstan": "run-phpstan-tests",
7379
"phpunit": "run-php-unit-tests",
7480
"prepare-tests": "install-package-tests",
7581
"test": [
7682
"@lint",
7783
"@phpcs",
84+
"@phpstan",
7885
"@phpunit",
7986
"@behat"
8087
]

0 commit comments

Comments
 (0)