Skip to content

Commit a58fdcb

Browse files
committed
Add PHPStan
Add Composer scripts for checking the code with PHPStan (while using a baseline) and for updating the baseline. When we fix PHPStan-reported issues (or update the PHPStan configuration), we can update the baseline bit by bit until all issues are fixed.
1 parent c9138f1 commit a58fdcb

File tree

5 files changed

+3096
-2
lines changed

5 files changed

+3096
-2
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
/.phive/
55
/Doxyfile export-ignore
66
/phpcs.xml export-ignore
7+
/phpstan-baseline.neon
8+
/phpstan.neon export-ignore
79
/phpunit.xml export-ignore
810
/tests export-ignore

.phive/phars.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<phive xmlns="https://phar.io/phive">
33
<phar name="phpcbf" version="^3.6.0" location="./.phive/phpcbf.phar" copy="false" installed="3.6.0"/>
44
<phar name="phpcs" version="^3.6.0" location="./.phive/phpcs.phar" copy="false" installed="3.6.0"/>
5+
<phar name="phpstan" version="^0.12.85" installed="0.12.85" location="./.phive/phpstan.phar" copy="false"/>
56
</phive>

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
"@ci:static"
2424
],
2525
"ci:php:sniff": "@php ./.phive/phpcs.phar lib tests",
26+
"ci:php:stan": "@php ./.phive/phpstan.phar",
2627
"ci:static": [
27-
"@ci:php:sniff"
28+
"@ci:php:sniff",
29+
"@ci:php:stan"
2830
],
2931
"fix:php": [
3032
"@fix:php:sniff"
3133
],
32-
"fix:php:sniff": "@php ./.phive/phpcbf.phar lib tests"
34+
"fix:php:sniff": "@php ./.phive/phpcbf.phar lib tests",
35+
"phpstan:baseline": "@php ./.phive/phpstan.phar --generate-baseline"
3336
}
3437
}

0 commit comments

Comments
 (0)