diff --git a/.gitattributes b/.gitattributes
index 559ab8d..33ba7cd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -14,4 +14,5 @@
/codeception.yml export-ignore
/phive.xml
/phpcs.xml export-ignore
+/phpstan.neon export-ignore
/tools/ export-ignore binary
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f90c527..fff7b13 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,6 +63,7 @@ jobs:
- "php:sniff"
- "php:codestyle"
- "php:copypaste"
+ - "php:stan"
- "composer:normalize"
php-version:
- 7.4
diff --git a/.gitlab/pipeline/.gitlab-ci.yml b/.gitlab/pipeline/.gitlab-ci.yml
index f1c6b6b..cfc2600 100644
--- a/.gitlab/pipeline/.gitlab-ci.yml
+++ b/.gitlab/pipeline/.gitlab-ci.yml
@@ -298,6 +298,17 @@ php-copypaste-check:
script:
- composer ci:php:copypaste
+phpstan:
+ extends: .default
+ stage: codestyle
+ needs:
+ - build-composer-dependencies
+ - php-lint-php7.2
+ - php-lint-php7.3
+ - php-lint-php7.4
+ script:
+ - composer ci:php:stan
+
composer-normalize:
extends: .default
stage: codestyle
diff --git a/README.md b/README.md
index 5dacf04..974d16d 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,10 @@ All of those checks are available in Github Actions and in Gitlab CI.
`composer ci:php:copypaste`
+### PHP type checking by [PHPStan](https://github.com/phpstan/phpstan)
+
+`composer ci:php:stan`
+
### JSON Lint check by [jsonlint](https://github.com/Seldaek/jsonlint)
`composer ci:json:lint`
diff --git a/composer.json b/composer.json
index 9bc8e15..b881bb4 100644
--- a/composer.json
+++ b/composer.json
@@ -89,6 +89,7 @@
"ci:php:copypaste": "php ./tools/phpcpd Classes Configuration Tests",
"ci:php:lint": "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l",
"ci:php:sniff": "php ./tools/phpcs Classes Configuration Tests",
+ "ci:php:stan": "php ./tools/phpstan analyse Classes",
"ci:static": [
"@ci:php:lint",
"@ci:php:sniff",
diff --git a/phive.xml b/phive.xml
index 57a658a..ab8904a 100644
--- a/phive.xml
+++ b/phive.xml
@@ -6,4 +6,5 @@
+
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..4989c54
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,7 @@
+parameters:
+ level: 3
+ bootstrapFiles:
+ - .Build/vendor/autoload.php
+ scanDirectories:
+ - Classes
+ - Tests
diff --git a/tools/phpstan b/tools/phpstan
new file mode 100755
index 0000000..dea3d16
Binary files /dev/null and b/tools/phpstan differ