Skip to content

Commit d2f3871

Browse files
[DependencyInjection] Mention autoconfiguration through attributes
1 parent cc496e0 commit d2f3871

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ so Symfony doesn't try to get/set its value from the related entity::
6060

6161
class ProductType extends AbstractType
6262
{
63-
public function buildForm(FormBuilderInterface $builder, array $options)
63+
public function buildForm(FormBuilderInterface $builder, array $options): void
6464
{
6565
$builder
6666
// ...

service_container.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,17 @@ you don't need to do *anything*: the service will be automatically loaded. Then,
948948
implements ``Twig\Extension\ExtensionInterface``. And thanks to ``autowire``, you can even add
949949
constructor arguments without any configuration.
950950

951+
Autconfiguration also works with attributes. Some attributes like
952+
:class:`Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler`,
953+
:class:`Symfony\\Component\\EventDispatcher\\Attribute\\AsEventListener` and
954+
:class:`Symfony\\Component\\Console\\Attribute\\AsCommand` are registered
955+
for autoconfiguration. Any class using these attributes will have tags applied
956+
to them.
957+
958+
.. versionadded:: 5.3
959+
960+
Autoconfiguration through attributes was introduced in Symfony 5.3.
961+
951962
Linting Service Definitions
952963
---------------------------
953964

0 commit comments

Comments
 (0)