Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent \Yiisoft\Router\CurrentRoute #188

Open
xepozz opened this issue Feb 11, 2023 · 2 comments
Open

Inconsistent \Yiisoft\Router\CurrentRoute #188

xepozz opened this issue Feb 11, 2023 · 2 comments

Comments

@xepozz
Copy link
Member

xepozz commented Feb 11, 2023

Due to \Yiisoft\Router\CurrentRoute doesn't have any restrictions it may be created with $container->get(), but it has whole empty state:
image

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?

@vjik
Copy link
Member

vjik commented Feb 11, 2023

Returns CurrentRoute|Route is confused.

By fact, CurrentRoute is RouteProvider.

@xepozz
Copy link
Member Author

xepozz commented Feb 11, 2023

It's not a provider by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants