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

[5.8] Add method to Guard contract #25650

Closed

Conversation

TBlindaruk
Copy link
Contributor

@TBlindaruk TBlindaruk commented Sep 16, 2018

[5.8] Add method to Guard contract

  • Added methods to the guard contract, since this method present in all Laravel Guards, but we could not use this if we will use the contact.

It is pretty the same PR as #25616

 - laravel#24518 in this PR was added method `hasUser` to the GuardHelper trait. As for me it will be useful to have this method in the contract.
 - Added methods to the guard contract, since this methods present in all Laravel Guards, but we could not use this if we will use the contact.
 - add notice to changelog;
@TBlindaruk TBlindaruk force-pushed the 5.8-add-methods-to-contract branch from a29f387 to 63a3e41 Compare September 16, 2018 22:37
@taylorotwell
Copy link
Member

Can you describe the benefit here? Is it for auto-completion purposes?

@TBlindaruk TBlindaruk changed the title [5.8] Add method to Guard contract [5.8] [WIP] Add method to Guard contract Sep 17, 2018
@TBlindaruk
Copy link
Contributor Author

@taylorotwell ,

It is not only for type hinting.

I`m as a developer do not want to use the concrete class when I have used the DI, instead of that I have used the interfaces.

When I have used the interface, then I could not use the method which presents in the concrete class, but not present on the interface, since if concrete class will be changed, then I could not guarantee, then new class have this method

@TBlindaruk TBlindaruk changed the title [5.8] [WIP] Add method to Guard contract [5.8] Add method to Guard contract Sep 17, 2018
@taylorotwell
Copy link
Member

They aren't really implementable at the contract level. At least authenticate isn't because the exception type it needs to throw is in the concrete illuminate/auth namespace.

Going to hold off for now as both of these methods are "convenience" helpers can you can achieve similar behavior without forcing all implementors to add them.

@TBlindaruk TBlindaruk deleted the 5.8-add-methods-to-contract branch September 17, 2018 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants