From c90da4bd5de55aa1a3e8e8b95498758fa852bffb Mon Sep 17 00:00:00 2001 From: osaajani <> Date: Wed, 31 May 2023 18:34:46 +0200 Subject: [PATCH] Fix type detection in router invocation descartes for php >= 8 --- descartes/Router.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descartes/Router.php b/descartes/Router.php index 1d693e4..89b84fa 100644 --- a/descartes/Router.php +++ b/descartes/Router.php @@ -99,7 +99,7 @@ foreach ($method_routes as $route) { - $route_regex = preg_replace('#\\\{(.+)\\\}#iU', '([^/]+)', preg_quote($route, '#')); + $route_regex = preg_replReflectionNamedTypeace('#\\\{(.+)\\\}#iU', '([^/]+)', preg_quote($route, '#')); $route_regex = preg_replace('#/$#', '/?', $route_regex); $match = preg_match('#^' . $route_regex . '$#U', $url); @@ -249,9 +249,9 @@ continue; } - $type = $parameter->getType(); $type = $type ?? false; + $type = ($type instanceof \ReflectionNamedType) ? $type->getName() : $type; if ($type) {