workflows: Add phpstan

This commit is contained in:
Sukhwinder Dhillon 2023-06-19 14:17:52 +02:00
parent 8923476277
commit 661bff8a9b
2 changed files with 33 additions and 2 deletions

View file

@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
os: ['ubuntu-latest']
steps:
@ -31,7 +31,13 @@ jobs:
tools: phpcs
- name: Setup dependencies
run: composer require -n --no-progress overtrue/phplint
run: |
composer require -n --no-progress overtrue/phplint
git clone --depth 1 https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
git clone --depth 1 https://github.com/Icinga/icingadb-web.git vendor/icingadb-web
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-director.git vendor/icingaweb2-module-director
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git vendor/icinga-php-library
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty
- name: PHP Lint
if: success() || matrix.allow_failure
@ -41,6 +47,10 @@ jobs:
if: success() || matrix.allow_failure
run: phpcs
- name: PHPStan
uses: php-actions/phpstan@v3
if: success() || matrix.allow_failure
test:
name: Unit tests with php ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

21
phpstan.neon Normal file
View file

@ -0,0 +1,21 @@
parameters:
level: 5
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
treatPhpDocTypesAsCertain: false
paths:
- application
- library
scanDirectories:
- vendor
ignoreErrors:
- '#Unsafe usage of new static\(\)#'
universalObjectCratesClasses:
- Icinga\Web\View
- ipl\Orm\Model
- Icinga\Module\Monitoring\Object\MonitoredObject