diff --git a/generate-spec.php b/generate-spec.php index 225b84c..1baa394 100755 --- a/generate-spec.php +++ b/generate-spec.php @@ -592,6 +592,11 @@ preg_match_all('/{[^}]*}/', $route->url, $urlParameters); $urlParameters = array_map(fn (string $name): string => substr($name, 1, -1), $urlParameters[0]); + $unusedRequirements = array_diff(array_keys($route->requirements), $urlParameters); + if ($unusedRequirements !== []) { + Logger::error($route->name, 'Unused requirements: ' . implode(',', $unusedRequirements)); + } + foreach ($urlParameters as $urlParameter) { $matchingParameters = array_filter($route->controllerMethod->parameters, fn (ControllerMethodParameter $param): bool => $param->name == $urlParameter); $requirement = $route->requirements[$urlParameter] ?? null;