-
-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Feature request
In https://www.drupal.org/project/drupal/issues/2723579 we realised that although we have deprecation support for routes, this doesn't work for RouteMatch::getRouteName() because that only returns a string for the current route.
We wondered whether it would be feasible to detect in phpstan when RouteMatch::getRouteName() is compared against a (hard coded) list of routes, and then point to the replacement route.
There is also https://www.drupal.org/project/drupal/issues/3506653 , which would provide a way to trigger a deprecation if a deprecated route name is used. But because there are valid reasons to get the current route name other than comparison, we wouldn't be able to deprecated RouteMatch::getRouteName() entirely.
However, if the hard-coded list of deprecated routes is not really viable, maybe phpstan could warn when the result of RouteMatch::getRouteName() is compared to a string, and recommend the new method instead?