From a9c370a8111ba555bfa606739945023489905834 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 1 Dec 2025 08:54:02 +0100 Subject: [PATCH 1/4] PHP 8.4: Change implicit nullable type declaration to explicit Since PHP 8.4 implicitly nullable parameter types are deprecated. --- src/BaseFilter.php | 4 ++-- src/Str.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BaseFilter.php b/src/BaseFilter.php index 267decb..e24f514 100644 --- a/src/BaseFilter.php +++ b/src/BaseFilter.php @@ -32,11 +32,11 @@ public function getBaseFilter() /** * Set the base filter * - * @param Rule $baseFilter + * @param ?Rule $baseFilter * * @return $this */ - public function setBaseFilter(Rule $baseFilter = null): self + public function setBaseFilter(?Rule $baseFilter = null): self { $this->baseFilter = $baseFilter; diff --git a/src/Str.php b/src/Str.php index b1cd19c..b48663a 100644 --- a/src/Str.php +++ b/src/Str.php @@ -76,7 +76,7 @@ public static function symmetricSplit(?string $subject, string $delimiter, int $ * * @return array */ - public static function trimSplit(?string $subject, string $delimiter = ',', int $limit = null) + public static function trimSplit(?string $subject, string $delimiter = ',', ?int $limit = null) { if ($subject === null || empty($delimiter)) { return []; From e982923ed3874e48d8cddffe17eeea4a54fa34a5 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 1 Dec 2025 14:49:15 +0100 Subject: [PATCH 2/4] PHP 8.4: Fix `PriorityQueue::insert()` return type declaration compatibility Since PHP 8.4 `SplPriorityQueue::insert()` has a tentative return of `true`. --- src/PriorityQueue.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PriorityQueue.php b/src/PriorityQueue.php index 1992ec5..2c3f448 100644 --- a/src/PriorityQueue.php +++ b/src/PriorityQueue.php @@ -25,9 +25,9 @@ class PriorityQueue extends SplPriorityQueue * @param TValue $value * @param TPriority $priority * - * @return bool + * @return true */ - public function insert($value, $priority): bool + public function insert($value, $priority): true { return parent::insert($value, [$priority, $this->serial--]); } From c2c9a6bc78d19851236b397369d4193db8525c2b Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Wed, 10 Dec 2025 13:25:08 +0100 Subject: [PATCH 3/4] phpstan.neon: Remove superfluous `scanDirectories` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `scanDirectories` was set to `/usr/share/icinga-php` to simplify local testing,  as both the Icinga PHP Library and Icinga PHP Thirdparty are installed there in our development environment. Our individual PHP library components, which make up these libraries, are self-contained, as they define all necessary dependencies themselves. This then requires testing with exactly these dependencies instead of an arbitrary folder that could contain anything, e.g., dependencies in unexpected versions or dependencies that have not yet been defined. For remote and local testing, `composer install` must be executed and tests must be performed with exactly the resulting dependencies. Since PHPStan uses the Composer autoloader by default, if available, `scanDirectories` does not need to be defined at all. --- phpstan.neon | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index b95427a..ef6cdd2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,9 +11,6 @@ parameters: paths: - src - scanDirectories: - - /usr/share/icinga-php - ignoreErrors: - messages: From dd095bda53910aeef65ca7ba593143d4b78baad7 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Thu, 11 Dec 2025 09:01:36 +0100 Subject: [PATCH 4/4] Fix programming error causing undefined property access when dynamic value is unset Dynamic property access ($row->{$column}) caused PHP warnings when `$value` was undefined, resulting in attempts to read non-existent properties. Updated the logic to use null coalescin, which safely returns `null` for missing properties and prevents these warnings. --- src/Filter.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Filter.php b/src/Filter.php index 3bbdd36..c5f7902 100644 --- a/src/Filter.php +++ b/src/Filter.php @@ -536,11 +536,7 @@ protected function performMatch(Rule $rule, $row) */ protected function extractValue($column, $row) { - try { - return $row->{$column}; - } catch (Throwable $_) { - return null; - } + return $row->$column ?? null; } /**