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 #442

Merged
merged 4 commits into from
Mar 26, 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
16 changes: 8 additions & 8 deletions .github/workflows/php.yml
sukhwinder33445 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +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/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
composer require -n --no-progress overtrue/phplint phpstan/phpstan
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2.git /icingaweb2
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/icingadb-web.git /usr/share/icingaweb2-modules/icingadb-web
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-director.git /usr/share/icingaweb2-modules/icingaweb2-module-director

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

- name: PHPStan
if: ${{ ! cancelled() }}
uses: php-actions/phpstan@v3
run: ./vendor/bin/phpstan analyse

test:
name: Unit tests with php ${{ matrix.php }} on ${{ matrix.os }}
Expand All @@ -61,7 +61,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 Down
4 changes: 3 additions & 1 deletion library/Businessprocess/Common/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public function setSort(?string $sort): self
return $this;
}

list($sortBy, $direction) = Str::symmetricSplit($sort, ' ', 2, 'asc');
/** @var array<int, string> $res */
sukhwinder33445 marked this conversation as resolved.
Show resolved Hide resolved
$res = Str::symmetricSplit($sort, ' ', 2, 'asc');
[$sortBy, $direction] = $res;

switch ($sortBy) {
case 'manual':
Expand Down
81 changes: 81 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$fp of function fpassthru expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$fp of function fputcsv expects resource, resource\\|false given\\.$#"
count: 2
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$fp of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 2
path: library/Businessprocess/BpConfig.php

-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, array\\<Icinga\\\\Module\\\\Businessprocess\\\\Node\\>\\|null given\\.$#"
count: 1
path: library/Businessprocess/BpNode.php

-
message: "#^Parameter \\#1 \\$str of function ucfirst expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeAction.php

-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php

-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#"
count: 2
path: library/Businessprocess/State/IcingaDbState.php

-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#1 \\$fp of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#1 \\$stack of function array_shift expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: library/Businessprocess/Web/Controller.php

-
message: "#^Parameter \\#1 \\$stack of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/FormLoader.php

-
message: "#^Parameter \\#1 \\$stack of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/QuickForm.php
81 changes: 81 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$stream of function fpassthru expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$stream of function fputcsv expects resource, resource\\|false given\\.$#"
count: 2
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$stream of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: application/controllers/ProcessController.php

-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 2
path: library/Businessprocess/BpConfig.php

-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, array\\<Icinga\\\\Module\\\\Businessprocess\\\\Node\\>\\|null given\\.$#"
count: 1
path: library/Businessprocess/BpNode.php

-
message: "#^Parameter \\#1 \\$string of function ucfirst expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeAction.php

-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php

-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 2
path: library/Businessprocess/State/IcingaDbState.php

-
message: "#^Parameter \\#1 \\$array of function array_shift expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#1 \\$stream of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php

-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: library/Businessprocess/Web/Controller.php

-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/FormLoader.php

-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/QuickForm.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-8x.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
}

return [
'includes' => $includes
];
Loading
Loading