-
Notifications
You must be signed in to change notification settings - Fork 12
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
Config Object #14
Config Object #14
Conversation
I would move the call to validation into the |
@adriansuter a way to mitigate that would be to make the constructor protected, what do you think? Also, could you show an example of an invalid configuration? Since all the constructor parameters are typed. I suppose you could do a white space string but that would be pretty dumb. |
Yes, but we should avoid those dumb (sometimes unintended) errors, shouldn't we? The setters can be removed, in my opinion. I don't see an example usage - and if needed, they could be added later on. I have a naming question. Is it |
@adriansuter right. I think that maybe we should rename I’ll remove the setters and make the constructor protected! |
What do you think about Symfony Validator? Using this component we can easily validate the config object.
I agreed. I think setters and unsetters are not needed. I have no idea when we would like to change the configuration at runtime. |
@l0gicgate
a makes more sense to me because then config directory can be resolved and used also as project's root directory which is passed to ConfigResolver's constructor (This is currently missing in this draft) |
The idea was to provide the ability to commands to change the config object if needed. You are right, it seems anti-pattern indeed. |
@ABGEO07
I'm not opposed to it considering we're already using two symfony packages, it would keep dependencies cohesive. My question here is, how much validation are we going to be doing, if the answer is more then it makes sense. Otherwise I'd like to stay away from including too many librairies. I want to pick your brain about global usage, how do we detect global usage sanely? I'm guessing we would use something like |
@adriansuter I just wrote all the tests for this. It's a pretty big PR, sorry. Please review when you have time. |
@l0gicgate I will try to find some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that was huge. Great work, @l0gicgate - all the tests are amazing.
By the way, shouldn't your homepage in composer.json
have https
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@l0gicgate You're a rocket.
Two minor changes (type hints). Other than that, I think we are good to go.
Wow we did it y'all! Thank you @adriansuter @ABGEO @flangofas. First piece of the puzzle is getting merged! |
I think that it's probably easier to start with this base versus rewriting #13 entirely.
We have quite a few decisions to make at this particular moment in regards to this:
AbstractCommand
object, setting theApplication
's configuration object from within a command seems like an anti-pattern, so I did not include it. I did include a getter though because I think it could be needed.Application
andConfiguration
should be extensible. The use case I imagine is a highly customizable console which just blends in with your project versus being standalone for Slim. This goes with the idea that we are allowing users to include external commands. I made theAPPLICATION_NAME
andVERSION
constants protected so one could extend them easily to override them. Let me know what y'all thinkNote:
This is mostly untested code and it's just so we can nail down the initial objects. Once we are in agreement I will write the tests.
Progress:
Closes #6