@@ -837,15 +837,16 @@ argument for *any* service defined in this file! You can bind arguments by name
837
837
The ``bind `` config can also be applied to specific services or when loading many
838
838
services at once (i.e. :ref: `service-psr4-loader `).
839
839
840
- Abstract service arguments
840
+ Abstract Service Arguments
841
841
--------------------------
842
842
843
- Sometimes, when defining services in your Symfony applications, there are arguments
844
- that can't be added in config files. The reason is that their values can only be
845
- calculated at runtime in a :doc: `compiler pass </service_container/compiler_passes >`
843
+ Sometimes, the values of some service arguments can't be defined in the
844
+ configuration files because they are calculated at runtime using a
845
+ :doc: `compiler pass </service_container/compiler_passes >`
846
846
or :doc: `bundle extension </bundles/extension >`.
847
847
848
- If value is not replaced a ``RuntimeException `` would be thrown.
848
+ In those cases, you can use the ``abstract `` argument type to define at least
849
+ the name of the argument and some short description about its purpose:
849
850
850
851
.. configuration-block ::
851
852
@@ -899,9 +900,13 @@ If value is not replaced a ``RuntimeException`` would be thrown.
899
900
// ...
900
901
};
901
902
902
- In this case, if you don't replace the value, ``RuntimeException `` will be thrown
903
- with message ``Argument "$rootNamespace" of service "App\Service\MyService" is
904
- abstract: should be defined by Pass. ``
903
+ If you don't replace the value of an abstract argument during runtime, a
904
+ ``RuntimeException `` will be thrown with a message like
905
+ ``Argument "$rootNamespace" of service "App\Service\MyService" is abstract: should be defined by Pass. ``
906
+
907
+ .. versionadded :: 5.1
908
+
909
+ The abstract service arguments were introduced in Symfony 5.1.
905
910
906
911
.. _services-autowire :
907
912
0 commit comments