Github Actions: Add PhpStan

This commit is contained in:
Sukhwinder Dhillon 2023-06-19 12:53:40 +02:00
parent 4714790b5d
commit 78ffc0a8d0
2 changed files with 115 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,14 @@ 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/icingaweb2-module-reporting.git vendor/reporting
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-x509.git vendor/x509
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-pdfexport.git vendor/pdfexport
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 +48,10 @@ jobs:
if: success() || matrix.allow_failure
run: phpcs -wps --colors
- 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 }}

102
phpstan.neon Normal file
View file

@ -0,0 +1,102 @@
parameters:
level: 2
checkFunctionNameCase: true
checkMissingIterableValueType: true
checkInternalClassCaseSensitivity: true
checkDynamicProperties: true
paths:
- application
- library
scanDirectories:
- vendor
ignoreErrors:
- '#Unsafe usage of new static\(\)#'
- '#. but return statement is missing#'
-
message: '#Call to an undefined method Predis\\Client::hGet\(\)#'
path: library/Icingadb/Common/ObjectInspectionDetail.php
-
message: '#Call to an undefined method ipl\\Html\\Contract\\FormElement::.*#'
paths:
- application/controllers/ServicesController.php
- application/forms/Command/Instance/ToggleInstanceFeaturesForm.php
- application/forms/Command/Object/AcknowledgeProblemForm.php
- application/forms/Command/Object/AddCommentForm.php
- application/forms/Command/Object/ScheduleCheckForm.php
- application/forms/Command/Object/ScheduleHostDowntimeForm.php
- application/forms/Command/Object/ScheduleServiceDowntimeForm.php
- application/forms/Command/Object/SendCustomNotificationForm.php
- application/forms/SetAsBackendForm.php
- library/Icingadb/Web/Control/ProblemToggle.php
- library/Icingadb/Widget/ItemTable/StateItemTable.php
-
message: '#Call to an undefined method ipl\\Stdlib\\Filter\\Rule::.*#'
path: library/Icingadb/Common/Auth.php
-
message: '#Call to an undefined method ipl\\Html\\Contract\\Wrappable::.*#'
paths:
- application/forms/Command/Object/ScheduleServiceDowntimeForm.php
- application/forms/Command/Object/ToggleObjectFeaturesForm.php
- library/Icingadb/Widget/Detail/CustomVarTable.php
- library/Icingadb/Common/SearchControls.php
-
message: '#PHPDoc tag @param references unknown parameter: .*#'
path: library/Icingadb/Common/SearchControls.php
-
message: '#Call to an undefined method ipl\\Html\\BaseHtmlElement::getDetailActionsDisabled\(\)#'
path: library/Icingadb/Common/DetailActions.php
-
message: '#Call to an undefined method Zend_Form_Element::isChecked\(\)#'
path: application/forms/RedisConfigForm.php
-
message: '#Access to an undefined property Zend_View_Interface.*#'
path: application/controllers/ErrorController.php
-
message: '#Call to an undefined method Zend_Controller_Action_Helper_Abstract.*#'
path: application/controllers/ServicesController.php
-
message: '#Call to an undefined method Zend_Form_Element::isChecked\(\)#'
path: library/Icingadb/Setup/RedisPage.php
-
message: '#Call to an undefined method Icinga\\Web\\Form::.*#'
path: library/Icingadb/Setup/IcingaDbWizard.php
-
message: '#Call to an undefined method Zend_Form_Element::setMultiOptions\(\)#'
path: library/Icingadb/Setup/DbResourcePage.php
-
message: '#Cannot call method setErrorHandlerModule\(\) on array\|Zend_Controller_Plugin_Abstract\|false#'
path: library/Icingadb/Web/Controller.php
-
message: '#Cannot access property \$flatname on array\<int\|string, mixed\>#'
path: library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
-
message: '#Access to an undefined property object::.*#'
paths:
- library/Icingadb/Widget/ItemList/StateListItem.php
- library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
- library/Icingadb/Widget/Detail/ObjectDetail.php
- library/Icingadb/Model/CustomvarFlat.php
universalObjectCratesClasses:
- ipl\Orm\Model
- Icinga\Web\View
- Icinga\Data\ConfigObject