Due to \Yiisoft\Router\CurrentRoute doesn't have any restrictions it may be created with $container->get(), but it has whole empty state:
It's unexpected and cause lots of if's over it.
Isn't it better to add RouteProvider with the getCurrent() method that will return either CurrentRoute or Route or throw an exception because it wasn't set before?
Due to
\Yiisoft\Router\CurrentRoute
doesn't have any restrictions it may be created with$container->get()
, but it has whole empty state:It's unexpected and cause lots of
if
's over it. Isn't it better to add RouteProvider with thegetCurrent()
method that will return either CurrentRoute or Route or throw an exception because it wasn't set before?