Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
Fixed code examples and format in the DI component documentation#2013
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
->addArgument('%mailer.transport%'); | ||
$container | ||
->register('mailer', 'Mailer') | ||
->addArgument('%mailer.transport%'); |
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.
I like breaking it onto 2 lines, but I don't usually add extra spaces on the second line of a chained call. Any reason why you're doing this - is it in the core code somewhere?
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.
If the method returns itself each time and you have method chaining, I won't indent the second line, but if the method returns a new instance it is nice to indent the next line. We have done that in thecomponent/config
article too.
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.
the only place where we use extra indentation levels when chaining in Symfony is when using theSymfony\Component\Config\Definition\TreeBuilder
, to make the indentation reflect the tree structure (making it far more readable than 100 chained calls indented the same)
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.
@wouterj, I see your point, and I don't think we have a super-clear standard here one way or another, but I'm personally -1 on the format. It makes more sense in theTreeBuilder
because you actually have->end()
statements at each node - so you build up the tree (and indent), and then have to work your way back down the tree (with->end()
). In this case, we're not returning the same instance, but it's not that same tree structure.
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.
@weaverryan ok, I will change it today.
Fixed code examples and format in the DI component documentation
Awesome, thanks! |
No description provided.