Skip to content

Commit 7597ea3

Browse files
committed
minor #18050 Be consistent in code examples (OskarStark)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Be consistent in code examples Follows #15731 (comment) cc `@HeahDude` Commits ------- 2426ce4 Be consistent in code examples
2 parents 245dd26 + 2426ce4 commit 7597ea3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

service_container/service_closures.rst

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ argument of type ``service_closure``:
5555
App\Service\MyService:
5656
arguments: [!service_closure '@mailer']
5757
58+
# In case the dependency is optional
59+
# arguments: [!service_closure '@?mailer']
60+
5861
.. code-block:: xml
5962
6063
<!-- config/services.xml -->
@@ -66,6 +69,11 @@ argument of type ``service_closure``:
6669
<services>
6770
<service id="App\Service\MyService">
6871
<argument type="service_closure" id="mailer"/>
72+
73+
<!--
74+
In case the dependency is optional
75+
<argument type="service_closure" id="mailer" on-invalid="ignore"/>
76+
-->
6977
</service>
7078
</services>
7179
</container>

0 commit comments

Comments
 (0)