Comments (5)
I think everything here that was mentioned is solved. Feel free to open a new issue if there are still things that need to be improved.
from oauth2-bundle.
I don't think we should blindly add interfaces to all final classes in the bundle just for some "test" purposes. For example I don't see any value in adding an interface for the UserConverter
class. I don't see the possibility of there being another implementation that justifies an interface (or it's very unlikely at least) nor does this implementation do any I/O or database calls etc which means doing new UserConverter()
in your tests is fine if you ask me.
from oauth2-bundle.
No, not "blindly". Final classes that are not "internal" should have an interface.
Speaking of your example of UserConverter
:
I like the OauthAuthorizationController
but I need do to some modifications to it. So I copied that class to my namespace and did my modifications. (Everything is perfect.) However, when I write unit tests from my new controller class I cannot mock its dependencies. That is reason 1 why we need an interface.
Reason 2 is that OauthAuthorizationController
has dependency on a concrete class. That violates the dependency inversion principle.
You are probably correct when you say that there will most likely not be an other implementation of the UserConverter
. However, adding an interface to be more correct will guarantee future proof code.
from oauth2-bundle.
Yep, I think we have to set UserConverterInterface, because I have to have possibility override UserConverter and implement my logic
from oauth2-bundle.
I just ran into a situation where a ScopeInterface
would have been nice.
When retrieving scopes from a custom system you could just implement it and return them.
from oauth2-bundle.
Related Issues (20)
- Symfony 5.3 new user interface support HOT 2
- Doctrine Bundle 2.4 support HOT 1
- How to get access token for all types of grants? HOT 3
- PHPDumper throws error on installation, string:OAUTH2_ENCRYPTION_KEY are never used
- How to override/extend Model-Classes for Client, AccessToken, etc
- Restricting routes by scope example HOT 1
- Symfony 5.3 Deprecation issue HOT 4
- in_memory persistence: provide client_id and client_secret from .env files HOT 1
- Writing the tests relying on config
- How can I get data from access token? HOT 2
- Symfony 5.3 Basic Setup, does not work! HOT 2
- [Question] How to manually generate a refresh token?
- Re-using unit test
- 1 package has known vulnerabilities HOT 1
- unexplained Client authentication failed error HOT 1
- Password Grant Flow
- Add Symfony 6 support HOT 2
- phpstan lvl 2 error on dev-master 09462b1 HOT 1
- sensio/framework-extra-bundle dependencya problem with 3.2.0 HOT 1
- is this project still maintained ? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2-bundle.