Skip to content

Commit bedfda0

Browse files
committed
Tweak
1 parent b81df68 commit bedfda0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

service_container/tags.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ method::
214214
}
215215
}
216216

217-
To go even further, the ``SensitiveElement`` attribute can be updated to be
218-
usable on methods::
217+
You can also make attributes usable on methods. To do so, update the previous
218+
example and add ``Attribute::TARGET_METHOD`::
219219

220220
// src/Attribute/SensitiveElement.php
221221
namespace App\Attribute;
@@ -226,9 +226,8 @@ usable on methods::
226226
// ...
227227
}
228228

229-
We should now update the call to
230-
:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration`
231-
to support ``ReflectionMethod``::
229+
Then, update the :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration`
230+
call to support ``ReflectionMethod``::
232231

233232
// src/Kernel.php
234233
use App\Attribute\SensitiveElement;
@@ -244,7 +243,7 @@ to support ``ReflectionMethod``::
244243
$container->registerAttributeForAutoconfiguration(SensitiveElement::class, static function (
245244
ChildDefinition $definition,
246245
SensitiveElement $attribute,
247-
// we update the union type to support multiple type of reflection
246+
// update the union type to support multiple types of reflection
248247
// you can also use the "\Reflector" interface
249248
\ReflectionClass|\ReflectionMethod $reflector): void {
250249
if ($reflection instanceof \ReflectionMethod) {
@@ -258,7 +257,7 @@ to support ``ReflectionMethod``::
258257
.. tip::
259258

260259
You can also define an attribute to be usable on properties and parameters with
261-
``Attribute::TARGET_PROPERTY`` and ``Attribute::TARGET_PARAMETER``, then support
260+
``Attribute::TARGET_PROPERTY`` and ``Attribute::TARGET_PARAMETER``; then support
262261
``ReflectionProperty`` and ``ReflectionParameter`` in your
263262
:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration`
264263
callable.

0 commit comments

Comments
 (0)