Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpstan: Streamline vendor file location with local dev-env #162

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
os: ['ubuntu-latest']

steps:
Expand All @@ -32,11 +32,12 @@ jobs:

- name: Setup dependencies
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/modules/icingadb-web
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
composer require -n --no-progress overtrue/phplint phpstan/phpstan
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git /usr/share/icinga-php/ipl
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git /usr/share/icinga-php/vendor
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2.git /icingaweb2
sudo git clone --depth 1 https://github.com/Icinga/icingadb-web.git /usr/share/icingaweb2-modules/icingadb


- name: PHP Lint
if: ${{ ! cancelled() }}
Expand All @@ -48,4 +49,4 @@ jobs:

- name: PHPStan
if: ${{ ! cancelled() }}
uses: php-actions/phpstan@v3
run: ./vendor/bin/phpstan analyse
16 changes: 16 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
ignoreErrors:
-
message: "#^Method Icinga\\\\Module\\\\Cube\\\\Ido\\\\IdoHostStatusCube\\:\\:listAvailableDimensions\\(\\) should return array but returns array\\<string, string\\>\\|false\\.$#"
count: 1
path: library/Cube/Ido/IdoHostStatusCube.php

-
message: "#^Method Icinga\\\\Module\\\\Cube\\\\Ido\\\\IdoServiceStatusCube\\:\\:listAvailableDimensions\\(\\) should return array but returns array\\<string, string\\>\\|false\\.$#"
count: 1
path: library/Cube/Ido/IdoServiceStatusCube.php

-
message: "#^Parameter \\#1 \\$function of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Zend_Db_Select, string\\} given\\.$#"
count: 1
path: library/Cube/Ido/ZfSelectWrapper.php
6 changes: 6 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Zend_Db_Select, string\\} given\\.$#"
count: 1
path: library/Cube/Ido/ZfSelectWrapper.php
12 changes: 12 additions & 0 deletions phpstan-baseline-by-php-version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$includes = [];
if (PHP_VERSION_ID < 80000) {
$includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-8x.neon';
}

return [
'includes' => $includes
];
10 changes: 0 additions & 10 deletions phpstan-baseline.neon → phpstan-baseline-standard.neon
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,6 @@ parameters:
count: 1
path: library/Cube/Ido/IdoCube.php

-
message: "#^Cannot access offset 'host'\\|'service' on array\\|stdClass\\.$#"
count: 1
path: library/Cube/Ido/IdoCube.php

-
message: "#^Cannot call method getDbAdapter\\(\\) on mixed\\.$#"
count: 1
Expand Down Expand Up @@ -990,11 +985,6 @@ parameters:
count: 1
path: library/Cube/Ido/ZfSelectWrapper.php

-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Zend_Db_Select, string\\} given\\.$#"
count: 1
path: library/Cube/Ido/ZfSelectWrapper.php

-
message: "#^Parameter \\#1 \\$rule of method ipl\\\\Stdlib\\\\Filter\\\\Chain\\:\\:add\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
Expand Down
7 changes: 5 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- phpstan-baseline.neon
- phpstan-baseline-standard.neon
- phpstan-baseline-by-php-version.php

parameters:
level: max
Expand All @@ -13,7 +14,9 @@ parameters:
- library

scanDirectories:
- vendor
- /icingaweb2
- /usr/share/icinga-php
- /usr/share/icingaweb2-modules

ignoreErrors:
-
Expand Down
Loading