- Fixed a bug where optional routes were badly parsed

This commit is contained in:
Dave Mc Nicoll 2024-11-01 16:44:52 -04:00
parent 3ffb69342b
commit b24bbbc150
1 changed files with 1 additions and 1 deletions

View File

@ -287,7 +287,7 @@ PATTERN;
if ($default ?? false) {
$value = $default;
}
elseif ( str_contains($route, "[{$matches[0][0]}]") === false && $this->enforceExistingArguments) {
elseif ( ! str_contains($route, "[{$matches[0][0]}]") && ! str_contains($route, "[/{$matches[0][0]}]") && $this->enforceExistingArguments) {
throw new \RuntimeException(sprintf("Error while preparing route %s : could not match variable '%s' into given arguments ( %s ) from %s::%s", $route, $variable, json_encode($arguments), $routeParam['class'], $routeParam['classMethod']));
}
}