Skip to content

Commit 2426ce4

Browse files
committed
Be consistent in code examples
1 parent b7392eb commit 2426ce4

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
@@ -58,6 +58,9 @@ argument of type ``service_closure``:
5858
App\Service\MyService:
5959
arguments: [!service_closure '@mailer']
6060
61+
# In case the dependency is optional
62+
# arguments: [!service_closure '@?mailer']
63+
6164
.. code-block:: xml
6265
6366
<!-- config/services.xml -->
@@ -69,6 +72,11 @@ argument of type ``service_closure``:
6972
<services>
7073
<service id="App\Service\MyService">
7174
<argument type="service_closure" id="mailer"/>
75+
76+
<!--
77+
In case the dependency is optional
78+
<argument type="service_closure" id="mailer" on-invalid="ignore"/>
79+
-->
7280
</service>
7381
</services>
7482
</container>

0 commit comments

Comments
 (0)