-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Added Yaml syntax shortcut for name-only tags #20651
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I just filled in the PR table incorrectly, someone please remove the BC break label 😃 |
Great 👍 Status: Reviewed |
👍 |
Thank you @wouterj. |
fabpot
added a commit
that referenced
this pull request
Dec 13, 2016
…ame-only tags (wouterj) This PR was merged into the 3.3-dev branch. Discussion ---------- [DependencyInjection] Added Yaml syntax shortcut for name-only tags | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | todo This PR adds a little shorcut for tags without any attributes. There are increasingly more name-only tags in Symfony and having to do `{ name: twig.extension }` for these seems way too verbose to me. **Before** ```yaml services: app.twig_extension: class: AppBundle\Twig\AppExtension tags: - { name: twig.extension } ``` **After** ```yaml services: app.twig_extension: class: AppBundle\Twig\AppExtension tags: [twig.extension] # or # - twig.extension ``` This of course means we introduce a new format to achieve the same goal. I believe this isn't a big problem as the decision is distinctive and simple: If you configure tag attributes, use the long format, otherwise use the short format. Backwards compatibility --- In this PR, an exception was removed to allow this new shortcut format. The BC promise doesn't cover exceptions and I think removing the exception here should cause anything to break: * Applications shouldn't rely on exceptions * If code was triggering this exception before, it would not cause any behaviour change after this PR: The service just retrieves an unused tag, which is simply ignored by the container. Commits ------- 7fa8c8a Added Yaml syntax shortcut for name-only tags
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
DependencyInjection
DX
DX = Developer eXperience (anything that improves the experience of using Symfony)
Feature
Status: Reviewed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a little shorcut for tags without any attributes. There are increasingly more name-only tags in Symfony and having to do
{ name: twig.extension }
for these seems way too verbose to me.Before
After
This of course means we introduce a new format to achieve the same goal. I believe this isn't a big problem as the decision is distinctive and simple: If you configure tag attributes, use the long format, otherwise use the short format.
Backwards compatibility
In this PR, an exception was removed to allow this new shortcut format. The BC promise doesn't cover exceptions and I think removing the exception here should cause anything to break: