Skip to content

Commit 2164b05

Browse files
committed
feature #19217 [DependencyInjection] Mention autoconfiguration through attributes (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Mention autoconfiguration through attributes <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- d2f3871 [DependencyInjection] Mention autoconfiguration through attributes
2 parents 46e6735 + d2f3871 commit 2164b05

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)