- Fixed optional arguments in buildUrl()

This commit is contained in:
Dave M. 2023-04-19 13:23:29 -04:00
parent 57367968ca
commit 5182ba19bc
1 changed files with 3 additions and 2 deletions

View File

@ -249,12 +249,13 @@ PATTERN;
if ($default ?? false) {
$value = $default;
}
elseif ($this->enforceExistingArguments) {
elseif ($this->enforceExistingArguments && ! strpos($route, sprintf('[/{%s:', $variable)) ) {
throw new \RuntimeException(sprintf("Error while preparing route %s : could not match variable '%s' into given arguments ( %s )", $route, $variable, json_encode($arguments)));
}
}
$search[ $item[0] ] = $value;
$search[$item[0]] = $value ?? "";
}
$route = str_replace(array_keys($search), array_values($search), $route);