-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Inconsistent tag parsing #22198
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
Comments
That's for bc, tagged scalars will be supported only in 4.0. |
Your're right... actually missed the deprecation. Point is https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L662 is not thrown for the deprecated notation. Guess little we can do here. |
Yes it's currently useless, it's here to be sure we won't forget it in 4.0. |
This PR was merged into the 3.4 branch. Discussion ---------- [DI] Reference tagged services in config | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12269 | License | MIT | Doc PR | symfony/symfony-docs#8404 This is a proof of concept to reference a sequence of tagged services. The problem bugs me for some time, and at first i thought the solution was to have some super generic compiler pass. If it could replace a lot of compilers in core.. perhaps worth it, but eventually each tag comes with it's own logic, including how to deal with tag attributes. However, writing the passes over and over again becomes tedious for the most basic usecase. So given the recent developments, this idea came to mind. ```yml services: a: class: stdClass properties: { a: true } tags: [foo] b: class: stdClass properties: { b: true } tags: [foo] c: class: stdClass properties: #stds: !tagged_services foo (see #22198) stds: !tagged_services foo ``` ``` dump(iterator_to_array($this->get('c')->stds)); ``` ``` array:2 [▼ 0 => {#5052 ▼ +"a": true } 1 => {#4667 ▼ +"b": true } ] ``` Given the _basic_ example at https://symfony.com/doc/current/service_container/tags.html, this could replace that. Any thoughts? Commits ------- 979e58f [DI] Reference tagged services in config
Seems like the YAML parser doesnt recognize tagged scalar nodes really well;
Considering DI; both
!iterator foo
and!iterator [foo]
produce a valid container, but a different value.The text was updated successfully, but these errors were encountered: