From 71389237e582405903bf3060bab0c9f99932a208 Mon Sep 17 00:00:00 2001 From: Petter Date: Mon, 16 Dec 2024 10:00:57 +0100 Subject: [PATCH 1/2] Update AltoRouter.php for php 8.4 Fix for php8.4 AltoRouter::map(): Implicitly marking parameter $name as nullable is deprecated. AltoRouter::match(): Implicitly marking parameter $requestUrl as nullable is deprecated. AltoRouter::match(): Implicitly marking parameter $requestMethod as nullable is deprecated. --- AltoRouter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltoRouter.php b/AltoRouter.php index b6c36ef..90a9b85 100644 --- a/AltoRouter.php +++ b/AltoRouter.php @@ -117,7 +117,7 @@ class AltoRouter * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application. * @throws Exception */ - public function map(string $method, string $route, $target, string $name = null) + public function map(string $method, string $route, $target, string|null $name = null) { $this->routes[] = [$method, $route, $target, $name]; @@ -184,7 +184,7 @@ class AltoRouter * @param string $requestMethod * @return array|boolean Array with route information on success, false on failure (no match). */ - public function match(string $requestUrl = null, string $requestMethod = null) + public function match(string|null $requestUrl = null, string|null $requestMethod = null) { $params = []; From 5159909a816138665f52e012ad52425d2805420a Mon Sep 17 00:00:00 2001 From: Petter Date: Mon, 16 Dec 2024 14:13:20 +0100 Subject: [PATCH 2/2] Update AltoRouter.php fix for php 8.4 and keep php 7.3 support --- AltoRouter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltoRouter.php b/AltoRouter.php index 90a9b85..a0081b3 100644 --- a/AltoRouter.php +++ b/AltoRouter.php @@ -117,7 +117,7 @@ class AltoRouter * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application. * @throws Exception */ - public function map(string $method, string $route, $target, string|null $name = null) + public function map(string $method, string $route, $target, ?string $name = null) { $this->routes[] = [$method, $route, $target, $name]; @@ -184,7 +184,7 @@ class AltoRouter * @param string $requestMethod * @return array|boolean Array with route information on success, false on failure (no match). */ - public function match(string|null $requestUrl = null, string|null $requestMethod = null) + public function match(?string $requestUrl = null, ?string $requestMethod = null) { $params = [];