Skip to content

Commit 76c4720

Browse files
committed
Minor tweaks
1 parent 0c6bcc6 commit 76c4720

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: service_container/alias_private.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ This means that when using the container directly, you can access the
181181
# ...
182182
app.mailer: '@App\Mail\PhpMailer'
183183
184-
The ``#[AsAlias]`` attribute also support per-environment configuration
185-
via the ``when`` argument::
184+
The ``#[AsAlias]`` attribute can also be limited to one or more specific
185+
:ref:`config environments <configuration-environments>` using the ``when`` argument::
186186

187187
// src/Mail/PhpMailer.php
188188
namespace App\Mail;
@@ -196,11 +196,16 @@ via the ``when`` argument::
196196
// ...
197197
}
198198

199-
You can pass either a string or an array of strings to the ``when`` argument.
199+
// pass an array to apply it in multiple config environments
200+
#[AsAlias(id: 'app.mailer', when: ['dev', 'test'])]
201+
class PhpMailer
202+
{
203+
// ...
204+
}
200205

201206
.. versionadded:: 7.3
202207

203-
The ``when`` argument on the ``#[AsAlias]`` attribute was introduced in Symfony 7.3.
208+
The ``when`` argument of the ``#[AsAlias]`` attribute was introduced in Symfony 7.3.
204209

205210
.. tip::
206211

0 commit comments

Comments
 (0)