Skip to content

Commit f7c4870

Browse files
committed
minor #18346 [DependencyInjection] Warns instanceof should be called before services registration (MatTheCat)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Warns `instanceof` should be called before services registration Fixes symfony/symfony#49988 and symfony/symfony#50329 Order matters when configuring the service container using PHP. Maybe we should warn about `defaults` too but I’m not sure where 🤔 Commits ------- dc2d048 [DependencyInjection] Warns `instanceof` should be called before services registration
2 parents 04ec225 + dc2d048 commit f7c4870

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

service_container/tags.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ If you want to apply tags automatically for your own services, use the
113113
->tag('app.custom_tag');
114114
};
115115
116+
.. caution::
117+
118+
If you're using PHP, you need to call ``instanceof`` before any service
119+
registration to make sure tags are correctly applied.
120+
116121
It is also possible to use the ``#[AutoconfigureTag]`` attribute directly on the
117122
base class or interface::
118123

0 commit comments

Comments
 (0)