Skip to content

Commit 01bf724

Browse files
authored
Support PHP 8.5 (#61)
PHP 8.4: - Function parameters that are null by default must be declared nullable - PriorityQueue: Ensure compatibility of return type with SplPriorityQueue Other changes: - Fix programming error causing undefined property access when dynamic value is unset - PHPStan `scanDirectories` was adjusted so that tests are always run with the dependencies installed by `composer install` No changes are required to support PHP 8.5.
2 parents df196ce + dd095bd commit 01bf724

5 files changed

Lines changed: 6 additions & 13 deletions

File tree

phpstan.neon

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ parameters:
1111
paths:
1212
- src
1313

14-
scanDirectories:
15-
- /usr/share/icinga-php
16-
1714
ignoreErrors:
1815
-
1916
messages:

src/BaseFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public function getBaseFilter()
3232
/**
3333
* Set the base filter
3434
*
35-
* @param Rule $baseFilter
35+
* @param ?Rule $baseFilter
3636
*
3737
* @return $this
3838
*/
39-
public function setBaseFilter(Rule $baseFilter = null): self
39+
public function setBaseFilter(?Rule $baseFilter = null): self
4040
{
4141
$this->baseFilter = $baseFilter;
4242

src/Filter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,7 @@ protected function performMatch(Rule $rule, $row)
536536
*/
537537
protected function extractValue($column, $row)
538538
{
539-
try {
540-
return $row->{$column};
541-
} catch (Throwable $_) {
542-
return null;
543-
}
539+
return $row->$column ?? null;
544540
}
545541

546542
/**

src/PriorityQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class PriorityQueue extends SplPriorityQueue
2525
* @param TValue $value
2626
* @param TPriority $priority
2727
*
28-
* @return bool
28+
* @return true
2929
*/
30-
public function insert($value, $priority): bool
30+
public function insert($value, $priority): true
3131
{
3232
return parent::insert($value, [$priority, $this->serial--]);
3333
}

src/Str.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function symmetricSplit(?string $subject, string $delimiter, int $
7676
*
7777
* @return array<string>
7878
*/
79-
public static function trimSplit(?string $subject, string $delimiter = ',', int $limit = null)
79+
public static function trimSplit(?string $subject, string $delimiter = ',', ?int $limit = null)
8080
{
8181
if ($subject === null || empty($delimiter)) {
8282
return [];

0 commit comments

Comments
 (0)