Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7253f1b

Browse filesBrowse files
committed
Minor tweaks
1 parent 171f4f5 commit 7253f1b
Copy full SHA for 7253f1b

File tree

Expand file treeCollapse file tree

1 file changed

+9
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-7
lines changed

‎service_container/autowiring.rst

Copy file name to clipboardExpand all lines: service_container/autowiring.rst
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,10 @@ Autowiring Anonymous Services Inline
869869

870870
The ``#[AutowireInline]`` attribute was added in Symfony 7.1.
871871

872-
Similar to how one can define anonymous services inline using configuration files,
872+
Similar to how anonymous services can be defined inline in configuration files,
873873
the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireInline`
874-
attribute allows declaring anonymous services inline next to their corresponding
875-
arguments::
874+
attribute allows you to declare anonymous services inline, directly next to their
875+
corresponding arguments::
876876

877877
public function __construct(
878878
#[AutowireInline(
@@ -888,11 +888,13 @@ arguments::
888888
) {
889889
}
890890

891-
As you might have already figured out, this declaration instructs Symfony to inject an
892-
object created by calling the ``ScopingHttpClient::forBaseUri()`` factory with the
893-
configured base URI and default options.
891+
This example tells Symfony to inject an object created by calling the
892+
``ScopingHttpClient::forBaseUri()`` factory with the specified base URI and
893+
default options. This is just one example: you can use the ``#[AutowireInline]``
894+
attribute to define any kind of anonymous service.
894895

895-
Of course, this is just an example and this attribute can be used to construct any kind of objects.
896+
While this approach is convenient for simple service definitions, consider moving
897+
complex or heavily configured services to a configuration file to ease maintenance.
896898

897899
Autowiring Controller Action Methods
898900
------------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.