UrlGeneratorInterface::generate as well as proxy methods in the base controller could check if the given route name is part of the defined routes in the application.
When refactoring routes it happens once in a while something gets missed and it occurred to me that PHPStan probably could have saved my ass. If the route is not commonly used it can otherwise go missed for a while until it fails at runtime.
One could even push this further to check param types by looking at the route pattern and what types the linked action require I guess.
Just a feature idea:
UrlGeneratorInterface::generate as well as proxy methods in the base controller could check if the given route name is part of the defined routes in the application.
When refactoring routes it happens once in a while something gets missed and it occurred to me that PHPStan probably could have saved my ass. If the route is not commonly used it can otherwise go missed for a while until it fails at runtime.
One could even push this further to check param types by looking at the route pattern and what types the linked action require I guess.