From 11beca762b31722e0e6690446f6dabf83bf9dafa Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 10 Jun 2026 19:00:32 +0100 Subject: code formatting --- src/AbstractStrategy.php | 4 +--- src/Contracts/Strategy.php | 1 + src/Enums/PathSegmentType.php | 6 +++--- src/PathSegmentTypeMatch.php | 3 ++- src/Router.php | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/AbstractStrategy.php b/src/AbstractStrategy.php index 206fd0d..a68f5c1 100644 --- a/src/AbstractStrategy.php +++ b/src/AbstractStrategy.php @@ -35,9 +35,7 @@ abstract class AbstractStrategy implements Strategy { foreach ($parameters as $key => $value) { if (!is_string($value)) { - throw new InvalidArgumentException( - "Parameter {$key} is not a string." - ); + throw new InvalidArgumentException("Parameter {$key} is not a string."); } } diff --git a/src/Contracts/Strategy.php b/src/Contracts/Strategy.php index bf447c3..afd1c8c 100644 --- a/src/Contracts/Strategy.php +++ b/src/Contracts/Strategy.php @@ -26,6 +26,7 @@ interface Strategy /** * @param array $parameters + * * @return array */ public function parseParameters(array $parameters): array; diff --git a/src/Enums/PathSegmentType.php b/src/Enums/PathSegmentType.php index 7cb1a51..414b945 100644 --- a/src/Enums/PathSegmentType.php +++ b/src/Enums/PathSegmentType.php @@ -26,10 +26,10 @@ enum PathSegmentType $regex = $type->routeMatchRegex(); if (preg_match($regex, $value, $matches) === 1) { $value = $matches[1]; - } - else { + } else { $type = PathSegmentType::Raw; } - return new PathSegmentTypeMatch( $type, $value); + + return new PathSegmentTypeMatch($type, $value); } } diff --git a/src/PathSegmentTypeMatch.php b/src/PathSegmentTypeMatch.php index 4e32bdb..c50e74e 100644 --- a/src/PathSegmentTypeMatch.php +++ b/src/PathSegmentTypeMatch.php @@ -9,5 +9,6 @@ readonly class PathSegmentTypeMatch final public function __construct( public PathSegmentType $type, public string $value, - ) {} + ) { + } } diff --git a/src/Router.php b/src/Router.php index 1c5e087..b219651 100644 --- a/src/Router.php +++ b/src/Router.php @@ -181,6 +181,7 @@ class Router { $route = $this->getNamedRoute($name); $params = $this->strategy->parseParameters($params); + return $route?->getPath($params); } } -- cgit v1.2.3