diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index fef9e7d..677ab24 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -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,12 +31,20 @@ jobs: tools: phpcs - name: Setup dependencies - run: composer require -n --no-progress overtrue/phplint + run: | + composer require -n --no-progress overtrue/phplint ipl/i18n:@dev + 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 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty - name: PHP Lint - if: success() || matrix.allow_failure + if: ${{ ! cancelled() }} run: ./vendor/bin/phplint -n --exclude={^vendor/.*} -- . - name: PHP CodeSniffer - if: success() || matrix.allow_failure + if: ${{ ! cancelled() }} run: phpcs + + - name: PHPStan + if: ${{ ! cancelled() }} + uses: php-actions/phpstan@v3 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..3acf2b3 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,96 @@ +parameters: + ignoreErrors: + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Controllers\\\\IntegrationsController\\:\\:indexAction\\(\\) has no return type specified\\.$#" + count: 1 + path: application/controllers/IntegrationsController.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Controllers\\\\IntegrationsController\\:\\:newAction\\(\\) has no return type specified\\.$#" + count: 1 + path: application/controllers/IntegrationsController.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Controllers\\\\IntegrationsController\\:\\:removeAction\\(\\) has no return type specified\\.$#" + count: 1 + path: application/controllers/IntegrationsController.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Controllers\\\\IntegrationsController\\:\\:updateAction\\(\\) has no return type specified\\.$#" + count: 1 + path: application/controllers/IntegrationsController.php + + - + message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:bind\\(\\) expects string, mixed given\\.$#" + count: 2 + path: application/controllers/IntegrationsController.php + + - + message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:remove\\(\\) expects string, mixed given\\.$#" + count: 1 + path: application/controllers/IntegrationsController.php + + - + message: "#^Cannot call method getValue\\(\\) on Zend_Form_Element\\|null\\.$#" + count: 3 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:add\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:createElements\\(\\) has no return type specified\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:createElements\\(\\) has parameter \\$formData with no value type specified in iterable type array\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:onRequest\\(\\) has no return type specified\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:add\\(\\) expects string, mixed given\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Generictts\\\\Forms\\\\Config\\\\TtsIntegrationConfigForm\\:\\:update\\(\\) expects string, mixed given\\.$#" + count: 1 + path: application/forms/Config/TtsIntegrationConfigForm.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Ticket\\:\\:createLink\\(\\) has parameter \\$match with no value type specified in iterable type array\\.$#" + count: 1 + path: library/Generictts/Ticket.php + + - + message: "#^Method Icinga\\\\Module\\\\Generictts\\\\Ticket\\:\\:init\\(\\) has no return type specified\\.$#" + count: 1 + path: library/Generictts/Ticket.php + + - + message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#" + count: 1 + path: library/Generictts/Ticket.php + + - + message: "#^Parameter \\#2 \\$pattern of method Icinga\\\\Application\\\\Hook\\\\TicketHook\\:\\:createTicketPattern\\(\\) expects string, mixed given\\.$#" + count: 1 + path: library/Generictts/Ticket.php + + - + message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, mixed given\\.$#" + count: 1 + path: library/Generictts/Ticket.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..3f551c5 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,26 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: max + + checkFunctionNameCase: true + checkInternalClassCaseSensitivity: true + treatPhpDocTypesAsCertain: false + + paths: + - application + - library + + scanDirectories: + - vendor + + ignoreErrors: + - + messages: + - '#Unsafe usage of new static\(\)#' + - '#. but return statement is missing#' + reportUnmatched: false + + universalObjectCratesClasses: + - Icinga\Web\View