From c2b0ed94c9232b9061e35ca1dfbe29d8c4034e3b Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Thu, 4 Dec 2025 11:59:52 +0100 Subject: [PATCH] PHP 8.4: Change implicit nullable type declaration to explicit Since PHP 8.4 implicitly nullable parameter types are deprecated. --- library/Graphite/Graphing/MetricsQuery.php | 2 +- library/Graphite/Util/TimeRangePickerTools.php | 2 +- library/Graphite/Web/Controller/TimeRangePickerTrait.php | 4 ++-- library/Graphite/Web/Widget/Graphs.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/Graphite/Graphing/MetricsQuery.php b/library/Graphite/Graphing/MetricsQuery.php index 93d0c907..6ad95504 100644 --- a/library/Graphite/Graphing/MetricsQuery.php +++ b/library/Graphite/Graphing/MetricsQuery.php @@ -62,7 +62,7 @@ public function __construct(MetricsDataSource $dataSource) $this->dataSource = $dataSource; } - public function from($target, array $fields = null) + public function from($target, ?array $fields = null) { if ($fields !== null) { throw new InvalidArgumentException('Fields are not applicable to this kind of query'); diff --git a/library/Graphite/Util/TimeRangePickerTools.php b/library/Graphite/Util/TimeRangePickerTools.php index d1ebc754..1248dfe9 100644 --- a/library/Graphite/Util/TimeRangePickerTools.php +++ b/library/Graphite/Util/TimeRangePickerTools.php @@ -41,7 +41,7 @@ public static function getAllRangeParameters() * * @return UrlParams The copy */ - public static function copyAllRangeParameters(UrlParams $copy = null, UrlParams $origin = null) + public static function copyAllRangeParameters(?UrlParams $copy = null, ?UrlParams $origin = null) { if ($origin === null) { $origin = Url::fromRequest()->getParams(); diff --git a/library/Graphite/Web/Controller/TimeRangePickerTrait.php b/library/Graphite/Web/Controller/TimeRangePickerTrait.php index 7352b1b4..3bd74304 100644 --- a/library/Graphite/Web/Controller/TimeRangePickerTrait.php +++ b/library/Graphite/Web/Controller/TimeRangePickerTrait.php @@ -23,11 +23,11 @@ trait TimeRangePickerTrait /** * Process the given request using the forms * - * @param Request $request The request to be processed + * @param ?Request $request The request to be processed * * @return Request The request supposed to be processed */ - protected function handleTimeRangePickerRequest(Request $request = null) + protected function handleTimeRangePickerRequest(?Request $request = null) { $this->getTimeRangePickerCommonForm()->handleRequest($request); return $this->getTimeRangePickerCustomForm()->handleRequest($request); diff --git a/library/Graphite/Web/Widget/Graphs.php b/library/Graphite/Web/Widget/Graphs.php index e49a0eb4..ce26ad83 100644 --- a/library/Graphite/Web/Widget/Graphs.php +++ b/library/Graphite/Web/Widget/Graphs.php @@ -204,11 +204,11 @@ public function __construct($object) /** * Process the given request using this widget * - * @param Request $request The request to be processed + * @param ?Request $request The request to be processed * * @return $this */ - public function handleRequest(Request $request = null) + public function handleRequest(?Request $request = null) { if ($request === null) { $request = Icinga::app()->getRequest();