From 6ecbd1b6b4845ae5fc065b61e48dd22ed3c9daa9 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 22 Jan 2024 09:55:53 +0100 Subject: [PATCH 1/9] phpistan: Streamline vendor file location with local dev-env phpstan is not run with an action anymore, as the action runs it its own docker container and hence has no access to files outside the repository root. A side-effect of this is, that phpstan now **really** runs with the php version set up by the matrix. --- .github/workflows/php.yml | 16 ++++++++-------- phpstan.neon | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 510c05f8d..d17da2f90 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,13 +32,13 @@ 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/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 + 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/icingaweb2-module-reporting.git /usr/share/icingaweb2-modules/reporting + sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-pdfexport.git /usr/share/icingaweb2-modules/pdfexport + sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-x509.git /usr/share/icingaweb2-modules/x509 - name: PHP Lint if: ${{ ! cancelled() }} @@ -50,7 +50,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 }} diff --git a/phpstan.neon b/phpstan.neon index 4cfb7e5e3..0529dbd74 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,7 +13,9 @@ parameters: - library scanDirectories: - - vendor + - /icingaweb2 + - /usr/share/icinga-php + - /usr/share/icingaweb2-modules ignoreErrors: - From 89c0bb0686fa91e2731754c9f21b2d94fedc0712 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 23 Jan 2024 08:43:02 +0100 Subject: [PATCH 2/9] Models: Add property type hints so that phpstan can scan correctly --- .../Icingadb/Model/AcknowledgementHistory.php | 16 ++++++++ library/Icingadb/Model/ActionUrl.php | 5 +++ library/Icingadb/Model/Checkcommand.php | 11 +++++ .../Icingadb/Model/CheckcommandArgument.php | 15 +++++++ .../Icingadb/Model/CheckcommandCustomvar.php | 6 +++ library/Icingadb/Model/CheckcommandEnvvar.php | 8 ++++ library/Icingadb/Model/Comment.php | 19 +++++++++ library/Icingadb/Model/CommentHistory.php | 18 +++++++++ library/Icingadb/Model/Customvar.php | 7 ++++ library/Icingadb/Model/CustomvarFlat.php | 8 ++++ library/Icingadb/Model/Downtime.php | 27 +++++++++++++ library/Icingadb/Model/DowntimeHistory.php | 23 +++++++++++ library/Icingadb/Model/Endpoint.php | 9 +++++ library/Icingadb/Model/Environment.php | 4 ++ library/Icingadb/Model/Eventcommand.php | 11 +++++ .../Icingadb/Model/EventcommandArgument.php | 15 +++++++ .../Icingadb/Model/EventcommandCustomvar.php | 6 +++ library/Icingadb/Model/EventcommandEnvvar.php | 8 ++++ library/Icingadb/Model/FlappingHistory.php | 14 +++++++ library/Icingadb/Model/History.php | 16 ++++++++ library/Icingadb/Model/Host.php | 40 +++++++++++++++++++ library/Icingadb/Model/HostCustomvar.php | 6 +++ library/Icingadb/Model/HostState.php | 2 + library/Icingadb/Model/Hostgroup.php | 10 +++++ library/Icingadb/Model/HostgroupCustomvar.php | 6 +++ library/Icingadb/Model/HostgroupMember.php | 6 +++ library/Icingadb/Model/Hostgroupsummary.php | 20 ++++++++++ library/Icingadb/Model/HoststateSummary.php | 14 +++++++ library/Icingadb/Model/IconImage.php | 5 +++ library/Icingadb/Model/Instance.php | 16 ++++++++ library/Icingadb/Model/NotesUrl.php | 5 +++ library/Icingadb/Model/Notification.php | 18 +++++++++ .../Icingadb/Model/NotificationCustomvar.php | 6 +++ .../Icingadb/Model/NotificationHistory.php | 16 ++++++++ library/Icingadb/Model/NotificationUser.php | 6 +++ .../Icingadb/Model/NotificationUsergroup.php | 6 +++ .../Icingadb/Model/Notificationcommand.php | 11 +++++ .../Model/NotificationcommandArgument.php | 15 +++++++ .../Model/NotificationcommandCustomvar.php | 6 +++ .../Model/NotificationcommandEnvvar.php | 8 ++++ library/Icingadb/Model/Service.php | 38 ++++++++++++++++++ library/Icingadb/Model/ServiceCustomvar.php | 6 +++ library/Icingadb/Model/Servicegroup.php | 10 +++++ .../Icingadb/Model/ServicegroupCustomvar.php | 6 +++ library/Icingadb/Model/ServicegroupMember.php | 6 +++ .../Icingadb/Model/ServicegroupSummary.php | 15 +++++++ .../Icingadb/Model/ServicestateSummary.php | 18 +++++++++ library/Icingadb/Model/StateHistory.php | 20 ++++++++++ library/Icingadb/Model/Timeperiod.php | 11 +++++ .../Icingadb/Model/TimeperiodCustomvar.php | 6 +++ .../Model/TimeperiodOverrideExclude.php | 6 +++ .../Model/TimeperiodOverrideInclude.php | 6 +++ library/Icingadb/Model/TimeperiodRange.php | 7 ++++ library/Icingadb/Model/User.php | 16 ++++++++ library/Icingadb/Model/UserCustomvar.php | 5 +++ library/Icingadb/Model/Usergroup.php | 10 +++++ library/Icingadb/Model/UsergroupCustomvar.php | 6 +++ library/Icingadb/Model/UsergroupMember.php | 5 +++ library/Icingadb/Model/Zone.php | 11 +++++ 59 files changed, 676 insertions(+) diff --git a/library/Icingadb/Model/AcknowledgementHistory.php b/library/Icingadb/Model/AcknowledgementHistory.php index 549d2ff26..50d194bbe 100644 --- a/library/Icingadb/Model/AcknowledgementHistory.php +++ b/library/Icingadb/Model/AcknowledgementHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -16,6 +17,21 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, the query * needs a `acknowledgement_history.service_id IS NULL OR acknowledgement_history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property DateTime $set_time + * @property ?DateTime $clear_time + * @property ?string $author + * @property ?string $cleared_by + * @property ?int $comment + * @property ?DateTime $expire_time + * @property ?bool $is_sticky + * @property ?bool $is_persistent */ class AcknowledgementHistory extends Model { diff --git a/library/Icingadb/Model/ActionUrl.php b/library/Icingadb/Model/ActionUrl.php index e0b092eed..928ce35d4 100644 --- a/library/Icingadb/Model/ActionUrl.php +++ b/library/Icingadb/Model/ActionUrl.php @@ -10,6 +10,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string[] $action_url + * @property string $environment_id + */ class ActionUrl extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Checkcommand.php b/library/Icingadb/Model/Checkcommand.php index 400a24bd1..692c86843 100644 --- a/library/Icingadb/Model/Checkcommand.php +++ b/library/Icingadb/Model/Checkcommand.php @@ -10,6 +10,17 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $zone_id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $command + * @property int $timeout + */ class Checkcommand extends Model { public function getTableName() diff --git a/library/Icingadb/Model/CheckcommandArgument.php b/library/Icingadb/Model/CheckcommandArgument.php index 3fb4ad5a3..4a24b138a 100644 --- a/library/Icingadb/Model/CheckcommandArgument.php +++ b/library/Icingadb/Model/CheckcommandArgument.php @@ -9,6 +9,21 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $checkcommand_id + * @property string $argument_key + * @property string $environment_id + * @property string $properties_checksum + * @property ?string $argument_value + * @property ?int $argument_order + * @property ?string $description + * @property ?string $argument_key_override + * @property string $repeat_key + * @property string $required + * @property ?string $set_if + * @property string $skip_key + */ class CheckcommandArgument extends Model { public function getTableName() diff --git a/library/Icingadb/Model/CheckcommandCustomvar.php b/library/Icingadb/Model/CheckcommandCustomvar.php index 0a834b58c..5382689f3 100644 --- a/library/Icingadb/Model/CheckcommandCustomvar.php +++ b/library/Icingadb/Model/CheckcommandCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $checkcommand_id + * @property string $customvar_id + * @property string $environment_id + */ class CheckcommandCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/CheckcommandEnvvar.php b/library/Icingadb/Model/CheckcommandEnvvar.php index 517a45fc5..05cdeed25 100644 --- a/library/Icingadb/Model/CheckcommandEnvvar.php +++ b/library/Icingadb/Model/CheckcommandEnvvar.php @@ -9,6 +9,14 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $checkcommand_id + * @property string $envvar_key + * @property string $environment_id + * @property string $properties_checksum + * @property string $envvar_value + */ class CheckcommandEnvvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Comment.php b/library/Icingadb/Model/Comment.php index bcdd5e05a..bdfcaf00a 100644 --- a/library/Icingadb/Model/Comment.php +++ b/library/Icingadb/Model/Comment.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behavior\Binary; @@ -12,6 +13,24 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $author + * @property string $text + * @property string $entry_type + * @property DateTime $entry_time + * @property bool $is_persistent + * @property bool $is_sticky + * @property ?DateTime $expire_time + * @property ?string $zone_id + */ class Comment extends Model { public function getTableName() diff --git a/library/Icingadb/Model/CommentHistory.php b/library/Icingadb/Model/CommentHistory.php index 5f03e685a..1cb02e3ad 100644 --- a/library/Icingadb/Model/CommentHistory.php +++ b/library/Icingadb/Model/CommentHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -16,6 +17,23 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, * the query needs a `comment_history.service_id IS NULL OR comment_history_service.id IS NOT NULL` where. + * + * @property string $comment_id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property DateTime $entry_time + * @property string $author + * @property ?string $removed_by + * @property string $comment + * @property string $entry_type + * @property bool $is_persistent + * @property bool $is_sticky + * @property ?DateTime $expire_time + * @property ?DateTime $remove_time + * @property bool $has_been_removed */ class CommentHistory extends Model { diff --git a/library/Icingadb/Model/Customvar.php b/library/Icingadb/Model/Customvar.php index e0432298c..70fb70980 100644 --- a/library/Icingadb/Model/Customvar.php +++ b/library/Icingadb/Model/Customvar.php @@ -9,6 +9,13 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $name + * @property string $value + */ class Customvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/CustomvarFlat.php b/library/Icingadb/Model/CustomvarFlat.php index 99d8acae1..db2434b07 100644 --- a/library/Icingadb/Model/CustomvarFlat.php +++ b/library/Icingadb/Model/CustomvarFlat.php @@ -11,6 +11,14 @@ use ipl\Orm\Relations; use Traversable; +/** + * @property string $id + * @property string $environment_id + * @property string $customvar_id + * @property string $flatname_checksum + * @property string $flatname + * @property string $flatvalue + */ class CustomvarFlat extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Downtime.php b/library/Icingadb/Model/Downtime.php index 7f600e93c..b2ba61710 100644 --- a/library/Icingadb/Model/Downtime.php +++ b/library/Icingadb/Model/Downtime.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behavior\Binary; @@ -12,6 +13,32 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property ?string $triggered_by_id + * @property ?string $parent_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $author + * @property string $comment + * @property DateTime $entry_time + * @property DateTime $scheduled_start_time + * @property DateTime $scheduled_end_time + * @property int $scheduled_duration + * @property bool $is_flexible + * @property int $flexible_duration + * @property bool $is_in_effect + * @property ?DateTime $start_time + * @property ?DateTime $end_time + * @property int $duration + * @property ?string $scheduled_by + * @property ?string $zone_id + */ class Downtime extends Model { public function getTableName() diff --git a/library/Icingadb/Model/DowntimeHistory.php b/library/Icingadb/Model/DowntimeHistory.php index 7ba992fb1..ca04441b7 100644 --- a/library/Icingadb/Model/DowntimeHistory.php +++ b/library/Icingadb/Model/DowntimeHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -16,6 +17,28 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, * the query needs a `downtime_history.service_id IS NULL OR downtime_history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property ?string $triggered_by_id + * @property ?string $parent_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property DateTime $entry_time + * @property string $author + * @property ?string $cancelled_by + * @property string $comment + * @property bool $is_flexible + * @property int $flexible_duration + * @property DateTime $scheduled_start_time + * @property DateTime $scheduled_end_time + * @property DateTime $start_time + * @property DateTime $end_time + * @property string $has_been_cancelled + * @property DateTime $trigger_time + * @property ?DateTime $cancel_time */ class DowntimeHistory extends Model { diff --git a/library/Icingadb/Model/Endpoint.php b/library/Icingadb/Model/Endpoint.php index 257001b74..f8a9b8c0f 100644 --- a/library/Icingadb/Model/Endpoint.php +++ b/library/Icingadb/Model/Endpoint.php @@ -9,6 +9,15 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $zone_id + */ class Endpoint extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Environment.php b/library/Icingadb/Model/Environment.php index 919ca1ce1..cd8208257 100644 --- a/library/Icingadb/Model/Environment.php +++ b/library/Icingadb/Model/Environment.php @@ -9,6 +9,10 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $name + */ class Environment extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Eventcommand.php b/library/Icingadb/Model/Eventcommand.php index ad18e2210..4b62354cb 100644 --- a/library/Icingadb/Model/Eventcommand.php +++ b/library/Icingadb/Model/Eventcommand.php @@ -10,6 +10,17 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property ?string $zone_id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $command + * @property string $timeout + */ class Eventcommand extends Model { public function getTableName() diff --git a/library/Icingadb/Model/EventcommandArgument.php b/library/Icingadb/Model/EventcommandArgument.php index 485e5d345..46f2956bb 100644 --- a/library/Icingadb/Model/EventcommandArgument.php +++ b/library/Icingadb/Model/EventcommandArgument.php @@ -9,6 +9,21 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $eventcommand_id + * @property string $argument_key + * @property string $environment_id + * @property string $properties_checksum + * @property ?string $argument_value + * @property ?string $argument_order + * @property ?string $description + * @property ?string $argument_key_override + * @property string $repeat_key + * @property string $required + * @property ?string $set_if + * @property string $skip_key + */ class EventcommandArgument extends Model { public function getTableName() diff --git a/library/Icingadb/Model/EventcommandCustomvar.php b/library/Icingadb/Model/EventcommandCustomvar.php index 3d1fa48e8..0da010bc8 100644 --- a/library/Icingadb/Model/EventcommandCustomvar.php +++ b/library/Icingadb/Model/EventcommandCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $eventcommand_id + * @property string $customvar_id + * @property string $environment_id + */ class EventcommandCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/EventcommandEnvvar.php b/library/Icingadb/Model/EventcommandEnvvar.php index 3883befcb..2eb8acf0f 100644 --- a/library/Icingadb/Model/EventcommandEnvvar.php +++ b/library/Icingadb/Model/EventcommandEnvvar.php @@ -9,6 +9,14 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $eventcommand_id + * @property string $envvar_key + * @property string $environment_id + * @property string $properties_checksum + * @property string $envvar_value + */ class EventcommandEnvvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/FlappingHistory.php b/library/Icingadb/Model/FlappingHistory.php index 69711ebdb..e060ca6e7 100644 --- a/library/Icingadb/Model/FlappingHistory.php +++ b/library/Icingadb/Model/FlappingHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; use ipl\Orm\Behaviors; @@ -15,6 +16,19 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, * the query needs a `flapping_history.service_id IS NULL OR flapping_history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property DateTime $start_time + * @property ?DateTime $end_time + * @property ?float $percent_state_change_start + * @property ?float $percent_state_change_end + * @property float $flapping_threshold_low + * @property float $flapping_threshold_high */ class FlappingHistory extends Model { diff --git a/library/Icingadb/Model/History.php b/library/Icingadb/Model/History.php index a34b3bdff..3643a22bb 100644 --- a/library/Icingadb/Model/History.php +++ b/library/Icingadb/Model/History.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -16,6 +17,21 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid * this, the query needs a `history.service_id IS NULL OR history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property ?string $comment_history_id + * @property ?string $downtime_history_id + * @property ?string $flapping_history_id + * @property ?string $notification_history_id + * @property ?string $acknowledgement_history_id + * @property ?string $state_history_id + * @property string $event_type + * @property DateTime $event_time */ class History extends Model { diff --git a/library/Icingadb/Model/Host.php b/library/Icingadb/Model/Host.php index e1296c80d..c6979839e 100644 --- a/library/Icingadb/Model/Host.php +++ b/library/Icingadb/Model/Host.php @@ -16,6 +16,46 @@ /** * Host model. + * + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property string $address + * @property string $address6 + * @property ?string $address_bin + * @property ?string $address6_bin + * @property string $checkcommand_name + * @property string $checkcommand_id + * @property int $max_check_attempts + * @property string $check_timeperiod_name + * @property ?string $check_timeperiod_id + * @property ?int $check_timeout + * @property int $check_interval + * @property int $check_retry_interval + * @property bool $active_checks_enabled + * @property bool $passive_checks_enabled + * @property bool $event_handler_enabled + * @property bool $notifications_enabled + * @property bool $flapping_enabled + * @property float $flapping_threshold_low + * @property float $flapping_threshold_high + * @property bool $perfdata_enabled + * @property string $eventcommand_name + * @property ?string $eventcommand_id + * @property bool $is_volatile + * @property ?string $action_url_id + * @property ?string $notes_url_id + * @property string $notes + * @property ?string $icon_image_id + * @property string $icon_image_alt + * @property string $zone_name + * @property ?string $zone_id + * @property string $command_endpoint_name + * @property ?string $command_endpoint_id */ class Host extends Model { diff --git a/library/Icingadb/Model/HostCustomvar.php b/library/Icingadb/Model/HostCustomvar.php index 9f7df2649..bda786b39 100644 --- a/library/Icingadb/Model/HostCustomvar.php +++ b/library/Icingadb/Model/HostCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $host_id + * @property string $customvar_id + * @property string $environment_id + */ class HostCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/HostState.php b/library/Icingadb/Model/HostState.php index efa275285..eb594a846 100644 --- a/library/Icingadb/Model/HostState.php +++ b/library/Icingadb/Model/HostState.php @@ -9,6 +9,8 @@ /** * Host state model. + * + * @property string $id */ class HostState extends State { diff --git a/library/Icingadb/Model/Hostgroup.php b/library/Icingadb/Model/Hostgroup.php index 97930faac..61f7aa2d4 100644 --- a/library/Icingadb/Model/Hostgroup.php +++ b/library/Icingadb/Model/Hostgroup.php @@ -10,6 +10,16 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property string $zone_id + */ class Hostgroup extends Model { public function getTableName() diff --git a/library/Icingadb/Model/HostgroupCustomvar.php b/library/Icingadb/Model/HostgroupCustomvar.php index 41272d142..d3dd09b2e 100644 --- a/library/Icingadb/Model/HostgroupCustomvar.php +++ b/library/Icingadb/Model/HostgroupCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $hostgroup_id + * @property string $customvar_id + * @property string $environment_id + */ class HostgroupCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/HostgroupMember.php b/library/Icingadb/Model/HostgroupMember.php index 3660e71aa..e03db733d 100644 --- a/library/Icingadb/Model/HostgroupMember.php +++ b/library/Icingadb/Model/HostgroupMember.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $host_id + * @property string $hostgroup_id + * @property string $environment_id + */ class HostgroupMember extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Hostgroupsummary.php b/library/Icingadb/Model/Hostgroupsummary.php index a9295bb16..637996b68 100644 --- a/library/Icingadb/Model/Hostgroupsummary.php +++ b/library/Icingadb/Model/Hostgroupsummary.php @@ -13,6 +13,26 @@ use ipl\Sql\Expression; use ipl\Sql\Select; +/** + * @property string $id + * @property string $display_name + * @property string $name + * @property int $hosts_down_handled + * @property int $hosts_down_unhandled + * @property int $hosts_pending + * @property int $hosts_total + * @property int $hosts_up + * @property int $hosts_severity + * @property int $services_critical_handled + * @property int $services_critical_unhandled + * @property int $services_ok + * @property int $services_pending + * @property int $services_total + * @property int $services_unknown_handled + * @property int $services_unknown_unhandled + * @property int $services_warning_handled + * @property int $services_warning_unhandled + */ class Hostgroupsummary extends UnionModel { public static function on(Connection $db) diff --git a/library/Icingadb/Model/HoststateSummary.php b/library/Icingadb/Model/HoststateSummary.php index 93268f348..3184c282d 100644 --- a/library/Icingadb/Model/HoststateSummary.php +++ b/library/Icingadb/Model/HoststateSummary.php @@ -7,6 +7,20 @@ use ipl\Sql\Connection; use ipl\Sql\Expression; +/** + * @property int $hosts_acknowledged + * @property int $hosts_active_checks_enabled + * @property int $hosts_passive_checks_enabled + * @property int $hosts_down_handled + * @property int $hosts_down_unhandled + * @property int $hosts_event_handler_enabled + * @property int $hosts_flapping_enabled + * @property int $hosts_notifications_enabled + * @property int $hosts_pending + * @property int $hosts_problems_unacknowledged + * @property int $hosts_total + * @property int $hosts_up + */ class HoststateSummary extends Host { public function getSummaryColumns() diff --git a/library/Icingadb/Model/IconImage.php b/library/Icingadb/Model/IconImage.php index 212234a9f..58f0be61c 100644 --- a/library/Icingadb/Model/IconImage.php +++ b/library/Icingadb/Model/IconImage.php @@ -9,6 +9,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $icon_image + * @property string $environment_id + */ class IconImage extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Instance.php b/library/Icingadb/Model/Instance.php index 73db56597..716d23da5 100644 --- a/library/Icingadb/Model/Instance.php +++ b/library/Icingadb/Model/Instance.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -11,6 +12,21 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property DateTime $heartbeat + * @property bool $responsible + * @property bool $icinga2_active_host_checks_enabled + * @property bool $icinga2_active_service_checks_enabled + * @property bool $icinga2_event_handlers_enabled + * @property bool $icinga2_flap_detection_enabled + * @property bool $icinga2_notifications_enabled + * @property bool $icinga2_performance_data_enabled + * @property DateTime $icinga2_start_time + * @property string $icinga2_version + */ class Instance extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotesUrl.php b/library/Icingadb/Model/NotesUrl.php index 5865c524f..138eaba0c 100644 --- a/library/Icingadb/Model/NotesUrl.php +++ b/library/Icingadb/Model/NotesUrl.php @@ -10,6 +10,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string[] $notes_url + * @property string $environment_id + */ class NotesUrl extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Notification.php b/library/Icingadb/Model/Notification.php index 8d423013a..968abca4b 100644 --- a/library/Icingadb/Model/Notification.php +++ b/library/Icingadb/Model/Notification.php @@ -11,6 +11,24 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $host_id + * @property ?string $service_id + * @property string $notificationcommand_id + * @property ?int $times_begin + * @property ?int $times_end + * @property string $notification_interval + * @property ?string $timeperiod_id + * @property array $states + * @property array $types + * @property ?string $zone_id + */ class Notification extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationCustomvar.php b/library/Icingadb/Model/NotificationCustomvar.php index 620ae5c5d..655d1de9f 100644 --- a/library/Icingadb/Model/NotificationCustomvar.php +++ b/library/Icingadb/Model/NotificationCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notification_id + * @property string $customvar_id + * @property string $environment_id + */ class NotificationCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationHistory.php b/library/Icingadb/Model/NotificationHistory.php index c635dbb5d..08903ad6f 100644 --- a/library/Icingadb/Model/NotificationHistory.php +++ b/library/Icingadb/Model/NotificationHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; @@ -16,6 +17,21 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, the * query needs a `notification_history.service_id IS NULL OR notification_history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property string $notification_id + * @property string $type + * @property DateTime $send_time + * @property int $state + * @property int $previous_hard_state + * @property string $author + * @property string $text + * @property int $users_notified */ class NotificationHistory extends Model { diff --git a/library/Icingadb/Model/NotificationUser.php b/library/Icingadb/Model/NotificationUser.php index ab23ad4fc..efb779cad 100644 --- a/library/Icingadb/Model/NotificationUser.php +++ b/library/Icingadb/Model/NotificationUser.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notification_id + * @property string $user_id + * @property string $environment_id + */ class NotificationUser extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationUsergroup.php b/library/Icingadb/Model/NotificationUsergroup.php index bd60fae7e..a50333753 100644 --- a/library/Icingadb/Model/NotificationUsergroup.php +++ b/library/Icingadb/Model/NotificationUsergroup.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notification_id + * @property string $usergroup_id + * @property string $environment_id + */ class NotificationUsergroup extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Notificationcommand.php b/library/Icingadb/Model/Notificationcommand.php index 6ee2a217b..c170aae40 100644 --- a/library/Icingadb/Model/Notificationcommand.php +++ b/library/Icingadb/Model/Notificationcommand.php @@ -10,6 +10,17 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property ?string $zone_id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $command + * @property int $timeout + */ class Notificationcommand extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationcommandArgument.php b/library/Icingadb/Model/NotificationcommandArgument.php index e8550226b..63a8c209e 100644 --- a/library/Icingadb/Model/NotificationcommandArgument.php +++ b/library/Icingadb/Model/NotificationcommandArgument.php @@ -9,6 +9,21 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notificationcommand_id + * @property string $argument_key + * @property string $environment_id + * @property string $properties_checksum + * @property ?string $argument_value + * @property ?string $argument_order + * @property ?string $description + * @property ?string $argument_key_override + * @property string $repeat_key + * @property string $required + * @property ?string $set_if + * @property string $skip_key + */ class NotificationcommandArgument extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationcommandCustomvar.php b/library/Icingadb/Model/NotificationcommandCustomvar.php index bd103f774..f5419272c 100644 --- a/library/Icingadb/Model/NotificationcommandCustomvar.php +++ b/library/Icingadb/Model/NotificationcommandCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notificationcommand_id + * @property string $customvar_id + * @property string $environment_id + */ class NotificationcommandCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/NotificationcommandEnvvar.php b/library/Icingadb/Model/NotificationcommandEnvvar.php index 09f77b0cc..0180be615 100644 --- a/library/Icingadb/Model/NotificationcommandEnvvar.php +++ b/library/Icingadb/Model/NotificationcommandEnvvar.php @@ -9,6 +9,14 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $notificationcommand_id + * @property string $envvar_key + * @property string $environment_id + * @property string $properties_checksum + * @property string $envvar_value + */ class NotificationcommandEnvvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Service.php b/library/Icingadb/Model/Service.php index c57b6ba12..1d97b96ac 100644 --- a/library/Icingadb/Model/Service.php +++ b/library/Icingadb/Model/Service.php @@ -14,6 +14,44 @@ use ipl\Orm\Relations; use ipl\Orm\ResultSet; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $host_id + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property string $checkcommand_name + * @property string $checkcommand_id + * @property int $max_check_attempts + * @property string $check_timeperiod_name + * @property ?string $check_timeperiod_id + * @property ?int $check_timeout + * @property int $check_interval + * @property int $check_retry_interval + * @property bool $active_checks_enabled + * @property bool $passive_checks_enabled + * @property bool $event_handler_enabled + * @property bool $notifications_enabled + * @property bool $flapping_enabled + * @property float $flapping_threshold_low + * @property float $flapping_threshold_high + * @property bool $perfdata_enabled + * @property string $eventcommand_name + * @property ?string $eventcommand_id + * @property bool $is_volatile + * @property ?string $action_url_id + * @property ?string $notes_url_id + * @property string $notes + * @property ?string $icon_image_id + * @property string $icon_image_alt + * @property string $zone_name + * @property ?string $zone_id + * @property string $command_endpoint_name + * @property ?string $command_endpoint_id + */ class Service extends Model { use Auth; diff --git a/library/Icingadb/Model/ServiceCustomvar.php b/library/Icingadb/Model/ServiceCustomvar.php index 07ee84c98..ba462f11f 100644 --- a/library/Icingadb/Model/ServiceCustomvar.php +++ b/library/Icingadb/Model/ServiceCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $service_id + * @property string $customvar_id + * @property string $environment_id + */ class ServiceCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Servicegroup.php b/library/Icingadb/Model/Servicegroup.php index 0da92fb4c..2e4b847b5 100644 --- a/library/Icingadb/Model/Servicegroup.php +++ b/library/Icingadb/Model/Servicegroup.php @@ -10,6 +10,16 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property ?string $zone_id + */ class Servicegroup extends Model { public function getTableName() diff --git a/library/Icingadb/Model/ServicegroupCustomvar.php b/library/Icingadb/Model/ServicegroupCustomvar.php index 23e536b51..01479eed9 100644 --- a/library/Icingadb/Model/ServicegroupCustomvar.php +++ b/library/Icingadb/Model/ServicegroupCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $servicegroup_id + * @property string $customvar_id + * @property string $environment_id + */ class ServicegroupCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/ServicegroupMember.php b/library/Icingadb/Model/ServicegroupMember.php index 5da537aa3..80a5054f3 100644 --- a/library/Icingadb/Model/ServicegroupMember.php +++ b/library/Icingadb/Model/ServicegroupMember.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $service_id + * @property string $servicegroup_id + * @property string $environment_id + */ class ServicegroupMember extends Model { public function getTableName() diff --git a/library/Icingadb/Model/ServicegroupSummary.php b/library/Icingadb/Model/ServicegroupSummary.php index 89a09539c..d66046704 100644 --- a/library/Icingadb/Model/ServicegroupSummary.php +++ b/library/Icingadb/Model/ServicegroupSummary.php @@ -13,6 +13,21 @@ use ipl\Sql\Expression; use ipl\Sql\Select; +/** + * @property string $id + * @property string $display_name + * @property string $name + * @property int $services_critical_handled + * @property int $services_critical_unhandled + * @property int $services_ok + * @property int $services_pending + * @property int $services_total + * @property int $services_unknown_handled + * @property int $services_unknown_unhandled + * @property int $services_warning_handled + * @property int $services_warning_unhandled + * @property int $services_severity + */ class ServicegroupSummary extends UnionModel { public static function on(Connection $db) diff --git a/library/Icingadb/Model/ServicestateSummary.php b/library/Icingadb/Model/ServicestateSummary.php index b1364f77f..daf3bec16 100644 --- a/library/Icingadb/Model/ServicestateSummary.php +++ b/library/Icingadb/Model/ServicestateSummary.php @@ -7,6 +7,24 @@ use ipl\Sql\Connection; use ipl\Sql\Expression; +/** + * @property int $services_acknowledged + * @property int $services_active_checks_enabled + * @property int $services_passive_checks_enabled + * @property int $services_critical_handled + * @property int $services_critical_unhandled + * @property int $services_event_handler_enabled + * @property int $services_flapping_enabled + * @property int $services_notifications_enabled + * @property int $services_ok + * @property int $services_pending + * @property int $services_problems_unacknowledged + * @property int $services_total + * @property int $services_unknown_handled + * @property int $services_unknown_unhandled + * @property int $services_warning_handled + * @property int $services_warning_unhandled + */ class ServicestateSummary extends Service { public function getSummaryColumns() diff --git a/library/Icingadb/Model/StateHistory.php b/library/Icingadb/Model/StateHistory.php index 9d80cb299..35d011527 100644 --- a/library/Icingadb/Model/StateHistory.php +++ b/library/Icingadb/Model/StateHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use DateTime; use ipl\Orm\Behavior\Binary; use ipl\Orm\Behavior\MillisecondTimestamp; use ipl\Orm\Behaviors; @@ -15,6 +16,25 @@ * * Please note that using this model will fetch history entries for decommissioned services. To avoid this, * the query needs a `state_history.service_id IS NULL OR state_history_service.id IS NOT NULL` where. + * + * @property string $id + * @property string $environment_id + * @property ?string $endpoint_id + * @property string $object_type + * @property string $host_id + * @property ?string $service_id + * @property DateTime $event_time + * @property string $state_type + * @property int $soft_state + * @property int $hard_state + * @property int $check_attempt + * @property int $previous_soft_state + * @property int $previous_hard_state + * @property ?string $output + * @property ?string $long_output + * @property int $max_check_attempts + * @property ?string $check_source + * @property ?string $scheduling_source */ class StateHistory extends Model { diff --git a/library/Icingadb/Model/Timeperiod.php b/library/Icingadb/Model/Timeperiod.php index 26dd72222..e1664103b 100644 --- a/library/Icingadb/Model/Timeperiod.php +++ b/library/Icingadb/Model/Timeperiod.php @@ -10,6 +10,17 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property string $prefer_includes + * @property ?string $zone_id + */ class Timeperiod extends Model { public function getTableName() diff --git a/library/Icingadb/Model/TimeperiodCustomvar.php b/library/Icingadb/Model/TimeperiodCustomvar.php index 614a312f2..2931068a8 100644 --- a/library/Icingadb/Model/TimeperiodCustomvar.php +++ b/library/Icingadb/Model/TimeperiodCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $timeperiod_id + * @property string $customvar_id + * @property string $environment_id + */ class TimeperiodCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/TimeperiodOverrideExclude.php b/library/Icingadb/Model/TimeperiodOverrideExclude.php index c33df775e..2764dfb65 100644 --- a/library/Icingadb/Model/TimeperiodOverrideExclude.php +++ b/library/Icingadb/Model/TimeperiodOverrideExclude.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $timeperiod_id + * @property string $override_id + * @property string $environment_id + */ class TimeperiodOverrideExclude extends Model { public function getTableName() diff --git a/library/Icingadb/Model/TimeperiodOverrideInclude.php b/library/Icingadb/Model/TimeperiodOverrideInclude.php index 54185969b..b92e9eed2 100644 --- a/library/Icingadb/Model/TimeperiodOverrideInclude.php +++ b/library/Icingadb/Model/TimeperiodOverrideInclude.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $timeperiod_id + * @property string $override_id + * @property string $environment_id + */ class TimeperiodOverrideInclude extends Model { public function getTableName() diff --git a/library/Icingadb/Model/TimeperiodRange.php b/library/Icingadb/Model/TimeperiodRange.php index 62e87f8cf..af945735a 100644 --- a/library/Icingadb/Model/TimeperiodRange.php +++ b/library/Icingadb/Model/TimeperiodRange.php @@ -9,6 +9,13 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $timeperiod_id + * @property string $range_key + * @property string $environment_id + * @property string $range_value + */ class TimeperiodRange extends Model { public function getTableName() diff --git a/library/Icingadb/Model/User.php b/library/Icingadb/Model/User.php index 91d0d717e..cdff22f88 100644 --- a/library/Icingadb/Model/User.php +++ b/library/Icingadb/Model/User.php @@ -11,6 +11,22 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property string $email + * @property string $pager + * @property string $notifications_enabled + * @property ?string $timeperiod_id + * @property array $states + * @property array $types + * @property ?string $zone_id + */ class User extends Model { public function getTableName() diff --git a/library/Icingadb/Model/UserCustomvar.php b/library/Icingadb/Model/UserCustomvar.php index a702b6809..efbe1ac32 100644 --- a/library/Icingadb/Model/UserCustomvar.php +++ b/library/Icingadb/Model/UserCustomvar.php @@ -9,6 +9,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $customvar_id + * @property string $environment_id + */ class UserCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Usergroup.php b/library/Icingadb/Model/Usergroup.php index 34b0647b9..281c9ce58 100644 --- a/library/Icingadb/Model/Usergroup.php +++ b/library/Icingadb/Model/Usergroup.php @@ -10,6 +10,16 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $display_name + * @property ?string $zone_id + */ class Usergroup extends Model { public function getTableName() diff --git a/library/Icingadb/Model/UsergroupCustomvar.php b/library/Icingadb/Model/UsergroupCustomvar.php index ab97273b1..cdc79bcc1 100644 --- a/library/Icingadb/Model/UsergroupCustomvar.php +++ b/library/Icingadb/Model/UsergroupCustomvar.php @@ -9,6 +9,12 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $usergroup_id + * @property string $customvar_id + * @property string $environment_id + */ class UsergroupCustomvar extends Model { public function getTableName() diff --git a/library/Icingadb/Model/UsergroupMember.php b/library/Icingadb/Model/UsergroupMember.php index 7c61d6777..be7608a97 100644 --- a/library/Icingadb/Model/UsergroupMember.php +++ b/library/Icingadb/Model/UsergroupMember.php @@ -9,6 +9,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $usergroup_id + * @property string $environment_id + */ class UsergroupMember extends Model { public function getTableName() diff --git a/library/Icingadb/Model/Zone.php b/library/Icingadb/Model/Zone.php index aaf3bbfd3..6d2391613 100644 --- a/library/Icingadb/Model/Zone.php +++ b/library/Icingadb/Model/Zone.php @@ -9,6 +9,17 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * @property string $id + * @property string $environment_id + * @property string $name_checksum + * @property string $properties_checksum + * @property string $name + * @property string $name_ci + * @property string $is_global + * @property ?string $parent_id + * @property string $depth + */ class Zone extends Model { public function getTableName() From 7d901a44a4218d0d6a6bdcf39afd8d054f2a3d89 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 23 Jan 2024 09:26:41 +0100 Subject: [PATCH 3/9] Fix phpstan's method call on null error --- library/Icingadb/Widget/Detail/DowntimeCard.php | 2 +- library/Icingadb/Widget/Detail/EventDetail.php | 6 +++--- library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/library/Icingadb/Widget/Detail/DowntimeCard.php b/library/Icingadb/Widget/Detail/DowntimeCard.php index 81f59dab7..8184479af 100644 --- a/library/Icingadb/Widget/Detail/DowntimeCard.php +++ b/library/Icingadb/Widget/Detail/DowntimeCard.php @@ -35,7 +35,7 @@ public function __construct(Downtime $downtime) $this->start = $this->downtime->scheduled_start_time->getTimestamp(); $this->end = $this->downtime->scheduled_end_time->getTimestamp(); - if ($this->downtime->end_time > $this->downtime->scheduled_end_time) { + if ($this->downtime->end_time && $this->downtime->end_time > $this->downtime->scheduled_end_time) { $this->duration = $this->downtime->end_time->getTimestamp() - $this->start; } else { $this->duration = $this->end - $this->start; diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php index 181c9aead..0b3c09a78 100644 --- a/library/Icingadb/Widget/Detail/EventDetail.php +++ b/library/Icingadb/Widget/Detail/EventDetail.php @@ -366,7 +366,7 @@ protected function assembleDowntimeEvent(DowntimeHistory $downtime) } $cancelInfo = []; - if ($downtime->has_been_cancelled) { + if ($downtime->has_been_cancelled && $downtime->cancel_time) { $cancelInfo = [ new HtmlElement('h2', null, Text::create(t('This downtime has been cancelled'))), new HorizontalKeyValue( @@ -430,7 +430,7 @@ protected function assembleCommentEvent(CommentHistory $comment) } $removedInfo = []; - if ($comment->has_been_removed) { + if ($comment->has_been_removed && $comment->remove_time) { $removedInfo[] = new HtmlElement('h2', null, Text::create(t('This comment has been removed'))); if ($comment->removed_by) { $removedInfo[] = new HorizontalKeyValue( @@ -487,7 +487,7 @@ protected function assembleFlappingEvent(FlappingHistory $flapping) $flapping->percent_state_change_start, $flapping->flapping_threshold_high )); - } else { + } elseif ($flapping->end_time !== null) { $eventInfo[] = new HorizontalKeyValue( t('Ended on'), DateFormatter::formatDateTime($flapping->end_time->getTimestamp()) diff --git a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php index 7ebc1f6dc..dedaa7215 100644 --- a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php +++ b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php @@ -56,7 +56,11 @@ abstract class BaseDowntimeListItem extends BaseListItem protected function init(): void { - if ($this->item->is_flexible && $this->item->is_in_effect) { + if ( + isset($this->item->start_time, $this->item->end_time) + && $this->item->is_flexible + && $this->item->is_in_effect + ) { $this->startTime = $this->item->start_time->getTimestamp(); $this->endTime = $this->item->end_time->getTimestamp(); } else { From e81822237a178e79d4ead168857f68b2026cbce3 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 23 Jan 2024 09:36:05 +0100 Subject: [PATCH 4/9] Fix some issues found by phpstan --- library/Icingadb/Widget/Detail/EventDetail.php | 2 +- library/Icingadb/Widget/HostSummaryDonut.php | 2 +- library/Icingadb/Widget/ServiceSummaryDonut.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php index 0b3c09a78..aaf76082f 100644 --- a/library/Icingadb/Widget/Detail/EventDetail.php +++ b/library/Icingadb/Widget/Detail/EventDetail.php @@ -567,7 +567,7 @@ protected function assembleAcknowledgeEvent(AcknowledgementHistory $acknowledgem if ($acknowledgement->cleared_by) { $eventInfo[] = new HorizontalKeyValue( t('Cleared by'), - [new Icon('user', $acknowledgement->cleared_by)] + [new Icon('user'), $acknowledgement->cleared_by] ); } else { $expired = false; diff --git a/library/Icingadb/Widget/HostSummaryDonut.php b/library/Icingadb/Widget/HostSummaryDonut.php index db5fef8c5..5efcf74d0 100644 --- a/library/Icingadb/Widget/HostSummaryDonut.php +++ b/library/Icingadb/Widget/HostSummaryDonut.php @@ -47,7 +47,7 @@ protected function assembleBody(BaseHtmlElement $body) ->addSlice($this->summary->hosts_down_handled, ['class' => 'slice-state-critical-handled']) ->addSlice($this->summary->hosts_down_unhandled, ['class' => 'slice-state-critical']) ->addSlice($this->summary->hosts_pending, ['class' => 'slice-state-pending']) - ->setLabelBig($this->summary->hosts_down_unhandled) + ->setLabelBig((string) $this->summary->hosts_down_unhandled) ->setLabelBigUrl(Links::hosts()->setFilter($labelBigUrlFilter)->addParams([ 'sort' => 'host.state.last_state_change' ])) diff --git a/library/Icingadb/Widget/ServiceSummaryDonut.php b/library/Icingadb/Widget/ServiceSummaryDonut.php index e806fba0f..e6b38a103 100644 --- a/library/Icingadb/Widget/ServiceSummaryDonut.php +++ b/library/Icingadb/Widget/ServiceSummaryDonut.php @@ -50,7 +50,7 @@ protected function assembleBody(BaseHtmlElement $body) ->addSlice($this->summary->services_unknown_handled, ['class' => 'slice-state-unknown-handled']) ->addSlice($this->summary->services_unknown_unhandled, ['class' => 'slice-state-unknown']) ->addSlice($this->summary->services_pending, ['class' => 'slice-state-pending']) - ->setLabelBig($this->summary->services_critical_unhandled) + ->setLabelBig((string) $this->summary->services_critical_unhandled) ->setLabelBigUrl(Links::services()->setFilter($labelBigUrlFilter)->addParams([ 'sort' => 'service.state.last_state_change' ])) From aba7e46f49224f134ac273135f85f525af17559a Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 23 Jan 2024 09:52:48 +0100 Subject: [PATCH 5/9] Update phpstan baseline --- phpstan-baseline.neon | 390 ------------------------------------------ 1 file changed, 390 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 262245dec..30ac74b50 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -495,11 +495,6 @@ parameters: count: 1 path: application/controllers/HostController.php - - - message: "#^Parameter \\#1 \\$title of method ipl\\\\Web\\\\Compat\\\\CompatController\\:\\:setTitle\\(\\) expects string, mixed given\\.$#" - count: 1 - path: application/controllers/HostController.php - - message: "#^Parameter \\#2 \\$apiResult of class Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\HostInspectionDetail constructor expects array, mixed given\\.$#" count: 1 @@ -520,11 +515,6 @@ parameters: count: 1 path: application/controllers/HostController.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 4 - path: application/controllers/HostController.php - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:lessThanOrEqual\\(\\) expects float\\|int\\|string, mixed given\\.$#" count: 1 @@ -555,11 +545,6 @@ parameters: count: 1 path: application/controllers/HostgroupController.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: application/controllers/HostgroupController.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostgroupController\\:\\:\\$hostgroup \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Hostgroupsummary\\) does not accept ipl\\\\Orm\\\\Model\\.$#" count: 1 @@ -915,11 +900,6 @@ parameters: count: 1 path: application/controllers/ServiceController.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 4 - path: application/controllers/ServiceController.php - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:lessThanOrEqual\\(\\) expects float\\|int\\|string, mixed given\\.$#" count: 1 @@ -950,11 +930,6 @@ parameters: count: 1 path: application/controllers/ServicegroupController.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: application/controllers/ServicegroupController.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServicegroupController\\:\\:\\$servicegroup \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\ServicegroupSummary\\) does not accept ipl\\\\Orm\\\\Model\\.$#" count: 1 @@ -2005,11 +1980,6 @@ parameters: count: 2 path: library/Icingadb/Command/Renderer/IcingaApiCommandRenderer.php - - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Renderer/IcingaApiCommandRenderer.php - - message: "#^Cannot access offset 'code' on mixed\\.$#" count: 1 @@ -2130,11 +2100,6 @@ parameters: count: 1 path: library/Icingadb/Common/Links.php - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/Links.php - - message: "#^Call to an undefined method Predis\\\\Client\\:\\:hGet\\(\\)\\.$#" count: 1 @@ -2380,11 +2345,6 @@ parameters: count: 1 path: library/Icingadb/Compat/CompatHost.php - - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost\\:\\:getBoolType\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: library/Icingadb/Compat/CompatHost.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost\\:\\:getName\\(\\) should return string but returns mixed\\.$#" count: 1 @@ -2610,11 +2570,6 @@ parameters: count: 1 path: library/Icingadb/Compat/CompatService.php - - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatService\\:\\:getBoolType\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: library/Icingadb/Compat/CompatService.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatService\\:\\:getHost\\(\\) should return Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost but returns Icinga\\\\Module\\\\Monitoring\\\\Object\\\\Host\\.$#" count: 1 @@ -4385,11 +4340,6 @@ parameters: count: 3 path: library/Icingadb/ProvidedHook/ApplicationState.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/ProvidedHook/CreateHostSlaReport.php - - message: "#^Parameter \\#1 \\$rule of static method ipl\\\\Web\\\\Filter\\\\QueryString\\:\\:render\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 1 @@ -4400,11 +4350,6 @@ parameters: count: 1 path: library/Icingadb/ProvidedHook/CreateServiceSlaReport.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/ProvidedHook/CreateServiceSlaReport.php - - message: "#^Parameter \\#1 \\$rule of static method ipl\\\\Web\\\\Filter\\\\QueryString\\:\\:render\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 1 @@ -4420,11 +4365,6 @@ parameters: count: 1 path: library/Icingadb/ProvidedHook/IcingaHealth.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 3 - path: library/Icingadb/ProvidedHook/IcingaHealth.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\ProvidedHook\\\\IcingaHealth\\:\\:getInstance\\(\\) should return Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Instance\\|null but returns ipl\\\\Orm\\\\Model\\|null\\.$#" count: 1 @@ -4805,11 +4745,6 @@ parameters: count: 3 path: library/Icingadb/Redis/VolatileStateResults.php - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Redis/VolatileStateResults.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 @@ -5230,11 +5165,6 @@ parameters: count: 1 path: library/Icingadb/Util/PluginOutput.php - - - message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:setCommandName\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Util/PluginOutput.php - - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|null given\\.$#" count: 1 @@ -6090,11 +6020,6 @@ parameters: count: 1 path: library/Icingadb/Widget/Detail/CustomVarTable.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 3 - path: library/Icingadb/Widget/Detail/DowntimeCard.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\DowntimeCard\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -6185,11 +6110,6 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 5 - path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - message: "#^Cannot call method isUnrestricted\\(\\) on Icinga\\\\User\\|null\\.$#" count: 4 @@ -6230,11 +6150,6 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - - message: "#^Parameter \\#1 \\$text of class Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\MarkdownText constructor expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 @@ -6250,11 +6165,6 @@ parameters: count: 2 path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 5 - path: library/Icingadb/Widget/Detail/DowntimeDetail.php - - message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -6320,11 +6230,6 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 21 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Cannot call method isUnrestricted\\(\\) on Icinga\\\\User\\|null\\.$#" count: 4 @@ -6400,11 +6305,6 @@ parameters: count: 1 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Parameter \\#1 \\$content of class Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput constructor expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Parameter \\#1 \\$denylist of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\EventDetail\\:\\:parseDenylist\\(\\) expects string, array\\ given\\.$#" count: 2 @@ -6430,41 +6330,16 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Parameter \\#1 \\$state of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\HostStates\\:\\:text\\(\\) expects int\\|null, mixed given\\.$#" - count: 6 - path: library/Icingadb/Widget/Detail/EventDetail.php - - - - message: "#^Parameter \\#1 \\$state of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\ServiceStates\\:\\:text\\(\\) expects int\\|null, mixed given\\.$#" - count: 6 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Parameter \\#1 \\$stateChange of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\EventDetail\\:\\:assembleStateChangeEvent\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\StateHistory, mixed given\\.$#" count: 1 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/EventDetail.php - - - - message: "#^Parameter \\#1 \\$subject of static method ipl\\\\Stdlib\\\\Str\\:\\:camel\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Parameter \\#2 \\$attributes of class ipl\\\\Web\\\\Widget\\\\Icon constructor expects array\\|ipl\\\\Html\\\\Attributes\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Parameter \\#2 \\$tableName of method ipl\\\\Orm\\\\Resolver\\:\\:qualifyColumn\\(\\) expects string, int\\\\|int\\<1, max\\>\\|string given\\.$#" count: 4 @@ -6475,21 +6350,6 @@ parameters: count: 2 path: library/Icingadb/Widget/Detail/EventDetail.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 5 - path: library/Icingadb/Widget/Detail/EventDetail.php - - - - message: "#^Parameter \\#3 \\$number of function tp expects int\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/EventDetail.php - - - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 3 - path: library/Icingadb/Widget/Detail/EventDetail.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\HostDetail\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -6960,11 +6820,6 @@ parameters: count: 2 path: library/Icingadb/Widget/Detail/QuickActions.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/QuickActions.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\ServiceDetail\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -7110,16 +6965,6 @@ parameters: count: 3 path: library/Icingadb/Widget/Detail/UserDetail.php - - - message: "#^Parameter \\#1 \\$states of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\UserDetail\\:\\:separateStates\\(\\) expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/UserDetail.php - - - - message: "#^Parameter \\#1 \\$types of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\UserDetail\\:\\:localizeTypes\\(\\) expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/Detail/UserDetail.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 @@ -7265,11 +7110,6 @@ parameters: count: 1 path: library/Icingadb/Widget/HostStatusBar.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: library/Icingadb/Widget/HostSummaryDonut.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\HostSummaryDonut\\:\\:assembleBody\\(\\) has no return type specified\\.$#" count: 1 @@ -7285,16 +7125,6 @@ parameters: count: 1 path: library/Icingadb/Widget/HostSummaryDonut.php - - - message: "#^Parameter \\#1 \\$data of method Icinga\\\\Chart\\\\Donut\\:\\:addSlice\\(\\) expects int, mixed given\\.$#" - count: 4 - path: library/Icingadb/Widget/HostSummaryDonut.php - - - - message: "#^Parameter \\#1 \\$labelBig of method Icinga\\\\Chart\\\\Donut\\:\\:setLabelBig\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/HostSummaryDonut.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 @@ -7305,11 +7135,6 @@ parameters: count: 1 path: library/Icingadb/Widget/IconImage.php - - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - message: "#^Cannot access property \\$host on mixed\\.$#" count: 1 @@ -7320,21 +7145,11 @@ parameters: count: 3 path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseCommentListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#" count: 1 path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - message: "#^Parameter \\#1 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseCommentListItem\\:\\:createHostLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#" count: 1 @@ -7345,16 +7160,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php - - message: "#^Cannot access property \\$host on mixed\\.$#" count: 1 @@ -7365,21 +7170,11 @@ parameters: count: 3 path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 5 - path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#" count: 1 path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - message: "#^Parameter \\#1 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:createHostLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#" count: 1 @@ -7390,11 +7185,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:\\$duration \\(int\\) does not accept string\\.$#" count: 1 @@ -7550,11 +7340,6 @@ parameters: count: 3 path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - - message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseHistoryListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#" count: 1 @@ -7570,31 +7355,11 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - - - message: "#^Parameter \\#1 \\$string of function ucfirst expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - message: "#^Parameter \\#2 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseHistoryListItem\\:\\:createServiceLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, object given\\.$#" count: 1 path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseHostListItem.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemList/BaseHostListItem.php - - message: "#^Access to an undefined property object\\:\\:\\$author\\.$#" count: 1 @@ -7675,11 +7440,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php - - message: "#^Parameter \\#1 \\$host of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\Links\\:\\:host\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#" count: 1 @@ -7690,11 +7450,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php - - message: "#^Access to an undefined property object\\:\\:\\$name\\.$#" count: 7 @@ -7750,11 +7505,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/HostListItemDetailed.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/HostListItemDetailed.php - - message: "#^Parameter \\#2 \\$value of method Icinga\\\\Web\\\\Url\\:\\:setParam\\(\\) expects array\\|bool\\|string, int given\\.$#" count: 1 @@ -7795,11 +7545,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php - - message: "#^Access to an undefined property object\\:\\:\\$icon_image_alt\\.$#" count: 1 @@ -7830,36 +7575,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/StateListItem.php - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php - - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseStateRowItem\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -7920,41 +7635,11 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemTable/HostRowItem.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemTable/HostRowItem.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 5 - path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php - - - - message: "#^Parameter \\#3 \\$number of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseHostGroupItem\\:\\:translatePlural\\(\\) expects int\\|null, mixed given\\.$#" - count: 4 - path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php - - - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 4 - path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 2 path: library/Icingadb/Widget/ItemTable/HostgroupTableRow.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemTable/HostgroupTableRow.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 2 @@ -8000,41 +7685,11 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemTable/ServiceRowItem.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Widget/ItemTable/ServiceRowItem.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 9 - path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php - - - - message: "#^Parameter \\#3 \\$number of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseServiceGroupItem\\:\\:translatePlural\\(\\) expects int\\|null, mixed given\\.$#" - count: 8 - path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php - - - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 8 - path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 1 path: library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#" count: 1 @@ -8210,36 +7865,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemTable/StateRowItem.php - - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/UserTableRow.php - - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 3 - path: library/Icingadb/Widget/ItemTable/UserTableRow.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/UserTableRow.php - - - - message: "#^Cannot access offset 0 on mixed\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php - - - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#" - count: 3 - path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php - - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ServiceStateBadges\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -8255,11 +7880,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ServiceStatusBar.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: library/Icingadb/Widget/ServiceSummaryDonut.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ServiceSummaryDonut\\:\\:assembleBody\\(\\) has no return type specified\\.$#" count: 1 @@ -8275,16 +7895,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ServiceSummaryDonut.php - - - message: "#^Parameter \\#1 \\$data of method Icinga\\\\Chart\\\\Donut\\:\\:addSlice\\(\\) expects int, mixed given\\.$#" - count: 8 - path: library/Icingadb/Widget/ServiceSummaryDonut.php - - - - message: "#^Parameter \\#1 \\$labelBig of method Icinga\\\\Chart\\\\Donut\\:\\:setLabelBig\\(\\) expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Widget/ServiceSummaryDonut.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 From ddd7a4ff8a6b5b7a3028ba9f7ca54dec064246f2 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 23 Jan 2024 11:45:47 +0100 Subject: [PATCH 6/9] Phpstan: Create php version based baseline --- phpstan-baseline-7x.neon | 151 ++++++++++++++++++ phpstan-baseline-8x.neon | 146 +++++++++++++++++ phpstan-baseline-by-php-version.php | 12 ++ ...ine.neon => phpstan-baseline-standard.neon | 145 ----------------- phpstan.neon | 3 +- 5 files changed, 311 insertions(+), 146 deletions(-) create mode 100644 phpstan-baseline-7x.neon create mode 100644 phpstan-baseline-8x.neon create mode 100644 phpstan-baseline-by-php-version.php rename phpstan-baseline.neon => phpstan-baseline-standard.neon (98%) diff --git a/phpstan-baseline-7x.neon b/phpstan-baseline-7x.neon new file mode 100644 index 000000000..dd196e846 --- /dev/null +++ b/phpstan-baseline-7x.neon @@ -0,0 +1,151 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$data of function hex2bin expects string, mixed given\\.$#" + count: 1 + path: application/controllers/EventController.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/AcknowledgeProblemForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/AddCommentForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: application/forms/Command/Object/CheckNowForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/DeleteCommentForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/DeleteDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ProcessCheckResultForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/RemoveAcknowledgementForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ScheduleCheckForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: application/forms/Command/Object/ScheduleHostDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/SendCustomNotificationForm.php + + - + message: "#^Parameter \\#1 \\$str of function md5 expects string, mixed given\\.$#" + count: 1 + path: application/forms/RedisConfigForm.php + + - + message: "#^Parameter \\#1 \\$stack of function array_pop expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Command/Transport/ApiCommandTransport.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Command/Transport/CommandTransport.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/IcingaRedis.php + + - + message: "#^Parameter \\#1 \\$arr1 of function array_diff_key expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + + - + message: "#^Parameter \\#1 \\$data of function bin2hex expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + count: 2 + path: library/Icingadb/Compat/UrlMigrator.php + + - + message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/CsvResultSet.php + + - + message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/CsvResultSet.php + + - + message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/PivotTable.php + + - + message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\\\|false given\\.$#" + count: 1 + path: library/Icingadb/Model/CustomvarFlat.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#" + count: 1 + path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php + + - + message: "#^Parameter \\#1 \\$number of function number_format expects float, float\\|int\\|string given\\.$#" + count: 1 + path: library/Icingadb/Util/PerfData.php + + - + message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|null given\\.$#" + count: 1 + path: library/Icingadb/Util/PluginOutput.php + + - + message: "#^Parameter \\#3 \\$encoding of function htmlspecialchars expects string, null given\\.$#" + count: 1 + path: library/Icingadb/Util/PluginOutput.php + + - + message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Web/Controller.php + + - + message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Web/Controller.php diff --git a/phpstan-baseline-8x.neon b/phpstan-baseline-8x.neon new file mode 100644 index 000000000..b6a33ef99 --- /dev/null +++ b/phpstan-baseline-8x.neon @@ -0,0 +1,146 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#" + count: 1 + path: application/controllers/EventController.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/AcknowledgeProblemForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/AddCommentForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: application/forms/Command/Object/CheckNowForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/DeleteCommentForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/DeleteDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ProcessCheckResultForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/RemoveAcknowledgementForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ScheduleCheckForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: application/forms/Command/Object/ScheduleHostDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 2 + path: application/forms/Command/Object/SendCustomNotificationForm.php + + - + message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#" + count: 1 + path: application/forms/RedisConfigForm.php + + - + message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Command/Transport/ApiCommandTransport.php + + - + message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Command/Transport/CommandTransport.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/IcingaRedis.php + + - + message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + + - + message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Common/ObjectInspectionDetail.php + + - + message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" + count: 2 + path: library/Icingadb/Compat/UrlMigrator.php + + - + message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/CsvResultSet.php + + - + message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/CsvResultSet.php + + - + message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Data/PivotTable.php + + - + message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\\\|false given\\.$#" + count: 1 + path: library/Icingadb/Model/CustomvarFlat.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#" + count: 1 + path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php + + - + message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#" + count: 1 + path: library/Icingadb/Util/PerfData.php + + - + message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#" + count: 1 + path: library/Icingadb/Util/PluginOutput.php + + - + message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Web/Controller.php + + - + message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" + count: 1 + path: library/Icingadb/Web/Controller.php diff --git a/phpstan-baseline-by-php-version.php b/phpstan-baseline-by-php-version.php new file mode 100644 index 000000000..4bd791e86 --- /dev/null +++ b/phpstan-baseline-by-php-version.php @@ -0,0 +1,12 @@ += 80000) { + $includes[] = __DIR__ . '/phpstan-baseline-8x.neon'; +} else { + $includes[] = __DIR__ . '/phpstan-baseline-7x.neon'; +} + +return [ + 'includes' => $includes +]; diff --git a/phpstan-baseline.neon b/phpstan-baseline-standard.neon similarity index 98% rename from phpstan-baseline.neon rename to phpstan-baseline-standard.neon index 30ac74b50..36864fb78 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline-standard.neon @@ -330,11 +330,6 @@ parameters: count: 1 path: application/controllers/EventController.php - - - message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#" - count: 1 - path: application/controllers/EventController.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\EventController\\:\\:\\$event \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\History\\) does not accept ipl\\\\Orm\\\\Model\\|null\\.$#" count: 1 @@ -1340,11 +1335,6 @@ parameters: count: 1 path: application/forms/Command/Object/AcknowledgeProblemForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/AcknowledgeProblemForm.php - - message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#" count: 1 @@ -1370,26 +1360,11 @@ parameters: count: 1 path: application/forms/Command/Object/AddCommentForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/AddCommentForm.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 1 - path: application/forms/Command/Object/CheckNowForm.php - - message: "#^Cannot call method getUsername\\(\\) on Icinga\\\\User\\|null\\.$#" count: 1 path: application/forms/Command/Object/DeleteCommentForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/DeleteCommentForm.php - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -1405,11 +1380,6 @@ parameters: count: 1 path: application/forms/Command/Object/DeleteDowntimeForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/DeleteDowntimeForm.php - - message: "#^Cannot access property \\$passive_checks_enabled on mixed\\.$#" count: 1 @@ -1440,11 +1410,6 @@ parameters: count: 1 path: application/forms/Command/Object/ProcessCheckResultForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/ProcessCheckResultForm.php - - message: "#^Cannot call method getUsername\\(\\) on Icinga\\\\User\\|null\\.$#" count: 1 @@ -1455,11 +1420,6 @@ parameters: count: 1 path: application/forms/Command/Object/RemoveAcknowledgementForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/RemoveAcknowledgementForm.php - - message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#" count: 1 @@ -1475,11 +1435,6 @@ parameters: count: 1 path: application/forms/Command/Object/ScheduleCheckForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/ScheduleCheckForm.php - - message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#" count: 2 @@ -1510,11 +1465,6 @@ parameters: count: 3 path: application/forms/Command/Object/ScheduleHostDowntimeForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 1 - path: application/forms/Command/Object/ScheduleHostDowntimeForm.php - - message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#" count: 1 @@ -1545,11 +1495,6 @@ parameters: count: 3 path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\Object\\\\ScheduleServiceDowntimeForm\\:\\:\\$flexibleEnd has no type specified\\.$#" count: 1 @@ -1575,11 +1520,6 @@ parameters: count: 1 path: application/forms/Command/Object/SendCustomNotificationForm.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" - count: 2 - path: application/forms/Command/Object/SendCustomNotificationForm.php - - message: "#^Cannot call method getAttributes\\(\\) on ipl\\\\Html\\\\Contract\\\\Wrappable\\|null\\.$#" count: 1 @@ -1810,11 +1750,6 @@ parameters: count: 1 path: application/forms/RedisConfigForm.php - - - message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#" - count: 1 - path: application/forms/RedisConfigForm.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" count: 1 @@ -2010,16 +1945,6 @@ parameters: count: 1 path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/CommandTransport.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Command\\\\Transport\\\\CommandTransportConfig\\:\\:\\$configs type has no value type specified in iterable type array\\.$#" count: 1 @@ -2085,11 +2010,6 @@ parameters: count: 1 path: library/Icingadb/Common/IcingaRedis.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/IcingaRedis.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\Links\\:\\:hostgroup\\(\\) has parameter \\$hostgroup with no type specified\\.$#" count: 1 @@ -2180,21 +2100,11 @@ parameters: count: 1 path: library/Icingadb/Common/ObjectInspectionDetail.php - - - message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Table\\:\\:td\\(\\) expects array\\|ipl\\\\Html\\\\Html\\|string\\|null, mixed given\\.$#" count: 1 path: library/Icingadb/Common/ObjectInspectionDetail.php - - - message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Common/ObjectInspectionDetail.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Common\\\\ObjectInspectionDetail\\:\\:\\$attrs type has no value type specified in iterable type array\\.$#" count: 1 @@ -2780,11 +2690,6 @@ parameters: count: 1 path: library/Icingadb/Compat/UrlMigrator.php - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 2 - path: library/Icingadb/Compat/UrlMigrator.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\CsvResultSet\\:\\:extractKeysAndValues\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -2795,16 +2700,6 @@ parameters: count: 1 path: library/Icingadb/Data/CsvResultSet.php - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - - - message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/CsvResultSet.php - - message: "#^Parameter \\#1 \\$key of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\CsvResultSet\\:\\:formatValue\\(\\) expects string, mixed given\\.$#" count: 1 @@ -2855,11 +2750,6 @@ parameters: count: 1 path: library/Icingadb/Data/PivotTable.php - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Data/PivotTable.php - - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Data\\\\PivotTable\\:\\:\\$gridcols type has no value type specified in iterable type array\\.$#" count: 1 @@ -3055,11 +2945,6 @@ parameters: count: 1 path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -3340,11 +3225,6 @@ parameters: count: 1 path: library/Icingadb/Model/CustomvarFlat.php - - - message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\\\|false given\\.$#" - count: 1 - path: library/Icingadb/Model/CustomvarFlat.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Downtime\\:\\:createBehaviors\\(\\) has no return type specified\\.$#" count: 1 @@ -4535,11 +4415,6 @@ parameters: count: 1 path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#" - count: 1 - path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 @@ -4965,11 +4840,6 @@ parameters: count: 1 path: library/Icingadb/Util/PerfData.php - - - message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#" - count: 1 - path: library/Icingadb/Util/PerfData.php - - message: "#^Parameter \\#1 \\$value of method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\ThresholdRange\\:\\:contains\\(\\) expects float, float\\|null given\\.$#" count: 2 @@ -5180,11 +5050,6 @@ parameters: count: 2 path: library/Icingadb/Util/PluginOutput.php - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#" - count: 1 - path: library/Icingadb/Util/PluginOutput.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|null given\\.$#" count: 1 @@ -5545,21 +5410,11 @@ parameters: count: 3 path: library/Icingadb/Web/Controller.php - - - message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - message: "#^Parameter \\#2 \\$array of function join expects array\\, array\\ given\\.$#" count: 1 path: library/Icingadb/Web/Controller.php - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Web/Controller.php - - message: "#^Parameter \\#2 \\$tableName of method ipl\\\\Orm\\\\Resolver\\:\\:qualifyColumn\\(\\) expects string, int\\\\|int\\<1, max\\>\\|string given\\.$#" count: 4 diff --git a/phpstan.neon b/phpstan.neon index 0529dbd74..5b8c6e846 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ includes: - - phpstan-baseline.neon + - phpstan-baseline-standard.neon + - phpstan-baseline-by-php-version.php parameters: level: max From 66877a6ed02217d7237ccdb869127a83b3ef7eb8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 14 Mar 2024 11:52:09 +0100 Subject: [PATCH 7/9] Model: Fix `@property` annotations --- library/Icingadb/Model/AcknowledgementHistory.php | 2 +- library/Icingadb/Model/Checkcommand.php | 2 +- library/Icingadb/Model/CheckcommandArgument.php | 2 ++ library/Icingadb/Model/CustomvarFlat.php | 2 +- library/Icingadb/Model/DowntimeHistory.php | 4 +++- library/Icingadb/Model/Eventcommand.php | 2 +- library/Icingadb/Model/EventcommandArgument.php | 4 +++- library/Icingadb/Model/HostState.php | 2 -- library/Icingadb/Model/Hostgroup.php | 2 +- library/Icingadb/Model/Notification.php | 6 +++--- library/Icingadb/Model/NotificationcommandArgument.php | 4 +++- library/Icingadb/Model/ServiceState.php | 5 +++++ library/Icingadb/Model/State.php | 7 ++++--- library/Icingadb/Model/User.php | 4 ++-- library/Icingadb/Model/UserCustomvar.php | 1 + library/Icingadb/Model/UsergroupMember.php | 1 + library/Icingadb/Model/Zone.php | 2 +- 17 files changed, 33 insertions(+), 19 deletions(-) diff --git a/library/Icingadb/Model/AcknowledgementHistory.php b/library/Icingadb/Model/AcknowledgementHistory.php index 50d194bbe..edbcc8378 100644 --- a/library/Icingadb/Model/AcknowledgementHistory.php +++ b/library/Icingadb/Model/AcknowledgementHistory.php @@ -28,7 +28,7 @@ * @property ?DateTime $clear_time * @property ?string $author * @property ?string $cleared_by - * @property ?int $comment + * @property ?string $comment * @property ?DateTime $expire_time * @property ?bool $is_sticky * @property ?bool $is_persistent diff --git a/library/Icingadb/Model/Checkcommand.php b/library/Icingadb/Model/Checkcommand.php index 692c86843..7f55c0dd9 100644 --- a/library/Icingadb/Model/Checkcommand.php +++ b/library/Icingadb/Model/Checkcommand.php @@ -12,7 +12,7 @@ /** * @property string $id - * @property string $zone_id + * @property ?string $zone_id * @property string $environment_id * @property string $name_checksum * @property string $properties_checksum diff --git a/library/Icingadb/Model/CheckcommandArgument.php b/library/Icingadb/Model/CheckcommandArgument.php index 4a24b138a..155f6dacf 100644 --- a/library/Icingadb/Model/CheckcommandArgument.php +++ b/library/Icingadb/Model/CheckcommandArgument.php @@ -22,6 +22,7 @@ * @property string $repeat_key * @property string $required * @property ?string $set_if + * @property ?string $separator * @property string $skip_key */ class CheckcommandArgument extends Model @@ -50,6 +51,7 @@ public function getColumns() 'repeat_key', 'required', 'set_if', + 'separator', 'skip_key' ]; } diff --git a/library/Icingadb/Model/CustomvarFlat.php b/library/Icingadb/Model/CustomvarFlat.php index db2434b07..f9f3c5a8f 100644 --- a/library/Icingadb/Model/CustomvarFlat.php +++ b/library/Icingadb/Model/CustomvarFlat.php @@ -17,7 +17,7 @@ * @property string $customvar_id * @property string $flatname_checksum * @property string $flatname - * @property string $flatvalue + * @property ?string $flatvalue */ class CustomvarFlat extends Model { diff --git a/library/Icingadb/Model/DowntimeHistory.php b/library/Icingadb/Model/DowntimeHistory.php index ca04441b7..b69a0979b 100644 --- a/library/Icingadb/Model/DowntimeHistory.php +++ b/library/Icingadb/Model/DowntimeHistory.php @@ -36,7 +36,8 @@ * @property DateTime $scheduled_end_time * @property DateTime $start_time * @property DateTime $end_time - * @property string $has_been_cancelled + * @property ?string $scheduled_by + * @property bool $has_been_cancelled * @property DateTime $trigger_time * @property ?DateTime $cancel_time */ @@ -72,6 +73,7 @@ public function getColumns() 'scheduled_end_time', 'start_time', 'end_time', + 'scheduled_by', 'has_been_cancelled', 'trigger_time', 'cancel_time' diff --git a/library/Icingadb/Model/Eventcommand.php b/library/Icingadb/Model/Eventcommand.php index 4b62354cb..68c1c065a 100644 --- a/library/Icingadb/Model/Eventcommand.php +++ b/library/Icingadb/Model/Eventcommand.php @@ -19,7 +19,7 @@ * @property string $name * @property string $name_ci * @property string $command - * @property string $timeout + * @property int $timeout */ class Eventcommand extends Model { diff --git a/library/Icingadb/Model/EventcommandArgument.php b/library/Icingadb/Model/EventcommandArgument.php index 46f2956bb..1f60ac25c 100644 --- a/library/Icingadb/Model/EventcommandArgument.php +++ b/library/Icingadb/Model/EventcommandArgument.php @@ -16,12 +16,13 @@ * @property string $environment_id * @property string $properties_checksum * @property ?string $argument_value - * @property ?string $argument_order + * @property ?int $argument_order * @property ?string $description * @property ?string $argument_key_override * @property string $repeat_key * @property string $required * @property ?string $set_if + * @property ?string $separator * @property string $skip_key */ class EventcommandArgument extends Model @@ -50,6 +51,7 @@ public function getColumns() 'repeat_key', 'required', 'set_if', + 'separator', 'skip_key' ]; } diff --git a/library/Icingadb/Model/HostState.php b/library/Icingadb/Model/HostState.php index eb594a846..efa275285 100644 --- a/library/Icingadb/Model/HostState.php +++ b/library/Icingadb/Model/HostState.php @@ -9,8 +9,6 @@ /** * Host state model. - * - * @property string $id */ class HostState extends State { diff --git a/library/Icingadb/Model/Hostgroup.php b/library/Icingadb/Model/Hostgroup.php index 61f7aa2d4..1ff6f0fba 100644 --- a/library/Icingadb/Model/Hostgroup.php +++ b/library/Icingadb/Model/Hostgroup.php @@ -18,7 +18,7 @@ * @property string $name * @property string $name_ci * @property string $display_name - * @property string $zone_id + * @property ?string $zone_id */ class Hostgroup extends Model { diff --git a/library/Icingadb/Model/Notification.php b/library/Icingadb/Model/Notification.php index 968abca4b..4c15d2eeb 100644 --- a/library/Icingadb/Model/Notification.php +++ b/library/Icingadb/Model/Notification.php @@ -23,10 +23,10 @@ * @property string $notificationcommand_id * @property ?int $times_begin * @property ?int $times_end - * @property string $notification_interval + * @property int $notification_interval * @property ?string $timeperiod_id - * @property array $states - * @property array $types + * @property string[] $states + * @property string[] $types * @property ?string $zone_id */ class Notification extends Model diff --git a/library/Icingadb/Model/NotificationcommandArgument.php b/library/Icingadb/Model/NotificationcommandArgument.php index 63a8c209e..e3a5e6757 100644 --- a/library/Icingadb/Model/NotificationcommandArgument.php +++ b/library/Icingadb/Model/NotificationcommandArgument.php @@ -16,12 +16,13 @@ * @property string $environment_id * @property string $properties_checksum * @property ?string $argument_value - * @property ?string $argument_order + * @property ?int $argument_order * @property ?string $description * @property ?string $argument_key_override * @property string $repeat_key * @property string $required * @property ?string $set_if + * @property ?string $separator * @property string $skip_key */ class NotificationcommandArgument extends Model @@ -50,6 +51,7 @@ public function getColumns() 'repeat_key', 'required', 'set_if', + 'separator', 'skip_key' ]; } diff --git a/library/Icingadb/Model/ServiceState.php b/library/Icingadb/Model/ServiceState.php index c5daa08cf..1d7dc31cd 100644 --- a/library/Icingadb/Model/ServiceState.php +++ b/library/Icingadb/Model/ServiceState.php @@ -7,6 +7,11 @@ use Icinga\Module\Icingadb\Common\ServiceStates; use ipl\Orm\Relations; +/** + * Service state model. + * + * @property string $service_id + */ class ServiceState extends State { public function getTableName() diff --git a/library/Icingadb/Model/State.php b/library/Icingadb/Model/State.php index 2d242a855..4529c9b10 100644 --- a/library/Icingadb/Model/State.php +++ b/library/Icingadb/Model/State.php @@ -16,6 +16,7 @@ /** * Base class for the {@link HostState} and {@link ServiceState} models providing common columns. * + * @property string $id * @property string $environment_id The environment id * @property string $state_type The state type (hard or soft) * @property int $soft_state The current soft state code (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN) @@ -44,9 +45,9 @@ * @property ?string $check_source The name of the node that executes the check * @property ?string $scheduling_source The name of the node that schedules the check * @property ?DateTime $last_update The time when the node was last updated - * @property ?DateTime $last_state_change The time when the node last got a status change - * @property ?DateTime $next_check The time when the node will execute the next check - * @property ?DateTime $next_update The time when the next check of the node is expected to end + * @property DateTime $last_state_change The time when the node last got a status change + * @property DateTime $next_check The time when the node will execute the next check + * @property DateTime $next_update The time when the next check of the node is expected to end */ abstract class State extends Model { diff --git a/library/Icingadb/Model/User.php b/library/Icingadb/Model/User.php index cdff22f88..1218de9e7 100644 --- a/library/Icingadb/Model/User.php +++ b/library/Icingadb/Model/User.php @@ -23,8 +23,8 @@ * @property string $pager * @property string $notifications_enabled * @property ?string $timeperiod_id - * @property array $states - * @property array $types + * @property string[] $states + * @property string[] $types * @property ?string $zone_id */ class User extends Model diff --git a/library/Icingadb/Model/UserCustomvar.php b/library/Icingadb/Model/UserCustomvar.php index efbe1ac32..883858bfb 100644 --- a/library/Icingadb/Model/UserCustomvar.php +++ b/library/Icingadb/Model/UserCustomvar.php @@ -12,6 +12,7 @@ /** * @property string $id * @property string $customvar_id + * @property string $user_id * @property string $environment_id */ class UserCustomvar extends Model diff --git a/library/Icingadb/Model/UsergroupMember.php b/library/Icingadb/Model/UsergroupMember.php index be7608a97..7abd5c820 100644 --- a/library/Icingadb/Model/UsergroupMember.php +++ b/library/Icingadb/Model/UsergroupMember.php @@ -12,6 +12,7 @@ /** * @property string $id * @property string $usergroup_id + * @property string $user_id * @property string $environment_id */ class UsergroupMember extends Model diff --git a/library/Icingadb/Model/Zone.php b/library/Icingadb/Model/Zone.php index 6d2391613..04d63ce9d 100644 --- a/library/Icingadb/Model/Zone.php +++ b/library/Icingadb/Model/Zone.php @@ -18,7 +18,7 @@ * @property string $name_ci * @property string $is_global * @property ?string $parent_id - * @property string $depth + * @property int $depth */ class Zone extends Model { From 2a9c06e7f6ca64093945958e93175c1dd3772692 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 14 Mar 2024 14:52:30 +0100 Subject: [PATCH 8/9] Some more fixes to make phpstan happy --- application/clicommands/MigrateCommand.php | 9 +++------ .../Command/Transport/CommandTransport.php | 4 ++-- library/Icingadb/Compat/CompatObject.php | 15 ++++++++------- .../Widget/ItemTable/BaseHostGroupItem.php | 4 ++-- .../Widget/ItemTable/BaseServiceGroupItem.php | 4 ++-- .../Widget/ItemTable/HostgroupTableRow.php | 4 ++-- .../Widget/ItemTable/ServicegroupTableRow.php | 4 ++-- 7 files changed, 21 insertions(+), 23 deletions(-) diff --git a/application/clicommands/MigrateCommand.php b/application/clicommands/MigrateCommand.php index 6d034ee39..17892bb45 100644 --- a/application/clicommands/MigrateCommand.php +++ b/application/clicommands/MigrateCommand.php @@ -496,9 +496,8 @@ public function dashboardAction(): void ); $changed = false; - /** @var ConfigObject $dashboardConfig */ + /** @var ConfigObject $dashboardConfig */ foreach ($dashboardsConfig->getConfigObject() as $name => $dashboardConfig) { - /** @var ?string $dashboardUrlString */ $dashboardUrlString = $dashboardConfig->get('url'); if ($dashboardUrlString !== null) { $dashBoardUrl = Url::fromPath($dashboardUrlString, [], new Request()); @@ -595,9 +594,8 @@ public function filterAction(): void private function transformNavigationItems(Config $config, string $owner, int &$rc): bool { $updated = false; - /** @var ConfigObject $newConfigObject */ + /** @var ConfigObject $newConfigObject */ foreach ($config->getConfigObject() as $section => $newConfigObject) { - /** @var string $configOwner */ $configOwner = $newConfigObject->get('owner') ?? ''; if ($configOwner && $configOwner !== $owner) { continue; @@ -686,9 +684,8 @@ private function migrateNavigationItems(Config $config, string $owner, string $p $newConfig = $config->getConfigFile() === $path ? $config : $this->readFromIni($path, $rc); $updated = false; - /** @var ConfigObject $configObject */ + /** @var ConfigObject $configObject */ foreach ($config->getConfigObject() as $configObject) { - /** @var string $configOwner */ $configOwner = $configObject->get('owner') ?? ''; if ($configOwner && $configOwner !== $owner) { continue; diff --git a/library/Icingadb/Command/Transport/CommandTransport.php b/library/Icingadb/Command/Transport/CommandTransport.php index ea125bc81..952cb1486 100644 --- a/library/Icingadb/Command/Transport/CommandTransport.php +++ b/library/Icingadb/Command/Transport/CommandTransport.php @@ -50,7 +50,7 @@ public static function getConfig(): Config /** * Create a transport from config * - * @param ConfigObject $config + * @param ConfigObject $config * * @return ApiCommandTransport * @@ -59,7 +59,7 @@ public static function getConfig(): Config public static function createTransport(ConfigObject $config): ApiCommandTransport { $config = clone $config; - switch (strtolower($config->transport)) { + switch (strtolower($config->transport ?? '')) { case ApiCommandTransport::TRANSPORT: $transport = new ApiCommandTransport(); break; diff --git a/library/Icingadb/Compat/CompatObject.php b/library/Icingadb/Compat/CompatObject.php index 6a30751d3..1d9657db8 100644 --- a/library/Icingadb/Compat/CompatObject.php +++ b/library/Icingadb/Compat/CompatObject.php @@ -361,13 +361,14 @@ protected function getDataView() */ private function getBoolType($value) { - switch ($value) { - case false: - return 0; - case true: - return 1; - case 'sticky': - return 2; + if ($value === 'sticky') { + return 2; } + + if (is_string($value)) { + return null; + } + + return (int) $value; } } diff --git a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php index c56a1f8f6..b3099c802 100644 --- a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php +++ b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Icingadb\Widget\ItemTable; use Icinga\Module\Icingadb\Common\Links; -use Icinga\Module\Icingadb\Model\Hostgroup; +use Icinga\Module\Icingadb\Model\Hostgroupsummary; use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; @@ -18,7 +18,7 @@ /** * Hostgroup item of a hostgroup list. Represents one database row. * - * @property Hostgroup $item + * @property Hostgroupsummary $item * @property HostgroupTable $table */ abstract class BaseHostGroupItem extends BaseTableRowItem diff --git a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php index 7bee532ef..24f0beaae 100644 --- a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php +++ b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Icingadb\Widget\ItemTable; use Icinga\Module\Icingadb\Common\Links; -use Icinga\Module\Icingadb\Model\Servicegroup; +use Icinga\Module\Icingadb\Model\ServicegroupSummary; use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; @@ -18,7 +18,7 @@ /** * Servicegroup item of a servicegroup list. Represents one database row. * - * @property Servicegroup $item + * @property ServicegroupSummary $item * @property ServicegroupTable $table */ abstract class BaseServiceGroupItem extends BaseTableRowItem diff --git a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php index 6aa61c271..cb3f06a9a 100644 --- a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php +++ b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Icingadb\Widget\ItemTable; -use Icinga\Module\Icingadb\Model\Hostgroup; +use Icinga\Module\Icingadb\Model\Hostgroupsummary; use Icinga\Module\Icingadb\Widget\Detail\HostStatistics; use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics; use ipl\Html\BaseHtmlElement; @@ -13,7 +13,7 @@ /** * Hostgroup table row of a hostgroup table. Represents one database row. * - * @property Hostgroup $item + * @property Hostgroupsummary $item * @property HostgroupTable $table */ class HostgroupTableRow extends BaseHostGroupItem diff --git a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php index 3dea4c1e5..e34c029ff 100644 --- a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php +++ b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Icingadb\Widget\ItemTable; -use Icinga\Module\Icingadb\Model\Servicegroup; +use Icinga\Module\Icingadb\Model\ServicegroupSummary; use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics; use ipl\Html\BaseHtmlElement; use ipl\Stdlib\Filter; @@ -12,7 +12,7 @@ /** * Servicegroup item of a servicegroup list. Represents one database row. * - * @property Servicegroup $item + * @property ServicegroupSummary $item * @property ServicegroupTable $table */ class ServicegroupTableRow extends BaseServiceGroupItem From b928705bceff1edcf886fa031d469c09be8e2d9d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 14 Mar 2024 15:10:10 +0100 Subject: [PATCH 9/9] phpstan: Update baselines --- phpstan-baseline-7x.neon | 5 ----- phpstan-baseline-8x.neon | 5 ----- phpstan-baseline-standard.neon | 25 ++++++++++++++++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/phpstan-baseline-7x.neon b/phpstan-baseline-7x.neon index dd196e846..06d60bdcb 100644 --- a/phpstan-baseline-7x.neon +++ b/phpstan-baseline-7x.neon @@ -70,11 +70,6 @@ parameters: count: 1 path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/CommandTransport.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#" count: 1 diff --git a/phpstan-baseline-8x.neon b/phpstan-baseline-8x.neon index b6a33ef99..98c0c79c8 100644 --- a/phpstan-baseline-8x.neon +++ b/phpstan-baseline-8x.neon @@ -70,11 +70,6 @@ parameters: count: 1 path: library/Icingadb/Command/Transport/ApiCommandTransport.php - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 1 - path: library/Icingadb/Command/Transport/CommandTransport.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" count: 1 diff --git a/phpstan-baseline-standard.neon b/phpstan-baseline-standard.neon index 36864fb78..192bde03f 100644 --- a/phpstan-baseline-standard.neon +++ b/phpstan-baseline-standard.neon @@ -510,6 +510,11 @@ parameters: count: 1 path: application/controllers/HostController.php + - + message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" + count: 1 + path: application/controllers/HostController.php + - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:lessThanOrEqual\\(\\) expects float\\|int\\|string, mixed given\\.$#" count: 1 @@ -540,6 +545,11 @@ parameters: count: 1 path: application/controllers/HostgroupController.php + - + message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" + count: 1 + path: application/controllers/HostgroupController.php + - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostgroupController\\:\\:\\$hostgroup \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Hostgroupsummary\\) does not accept ipl\\\\Orm\\\\Model\\.$#" count: 1 @@ -895,6 +905,11 @@ parameters: count: 1 path: application/controllers/ServiceController.php + - + message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" + count: 2 + path: application/controllers/ServiceController.php + - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:lessThanOrEqual\\(\\) expects float\\|int\\|string, mixed given\\.$#" count: 1 @@ -925,6 +940,11 @@ parameters: count: 1 path: application/controllers/ServicegroupController.php + - + message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" + count: 1 + path: application/controllers/ServicegroupController.php + - message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServicegroupController\\:\\:\\$servicegroup \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\ServicegroupSummary\\) does not accept ipl\\\\Orm\\\\Model\\.$#" count: 1 @@ -7415,11 +7435,6 @@ parameters: count: 1 path: library/Icingadb/Widget/ItemList/StateListItem.php - - - message: "#^Cannot call method getTimestamp\\(\\) on DateTime\\|null\\.$#" - count: 1 - path: library/Icingadb/Widget/ItemList/StateListItem.php - - message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\StateListItem\\:\\:createSubject\\(\\) has no return type specified\\.$#" count: 1