Skip to content

Commit 1a8b82e

Browse files
committed
feature #60103 [Console] Mark AsCommand attribute as @final (Somrlik, GromNaN)
This PR was merged into the 7.3 branch. Discussion ---------- [Console] Mark `AsCommand` attribute as ``@final`` | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | yes | License | MIT `AsCommand` attribute doesn't work as expected when extended and probably should be declared as final. In order to not break BC and trigger a deprecation warning, I marked the attribute as ``@final`` as per suggestions in previous PR. Superseeds #60066 as I closed it accidentally, sorry for confusion 😕 Commits ------- 1db80a5 [Console] Mark `AsCommand` attribute as ``@final``
2 parents 58a14ab + 1db80a5 commit 1a8b82e

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

UPGRADE-7.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Console
4040
```
4141

4242
* Deprecate methods `Command::getDefaultName()` and `Command::getDefaultDescription()` in favor of the `#[AsCommand]` attribute
43+
* `#[AsCommand]` attribute is now marked as `@final`; you should use separate attributes to add more logic to commands
4344

4445
DependencyInjection
4546
-------------------

src/Symfony/Component/Console/Attribute/AsCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/**
1515
* Service tag to autoconfigure commands.
16+
*
17+
* @final since Symfony 7.3
1618
*/
1719
#[\Attribute(\Attribute::TARGET_CLASS)]
1820
class AsCommand

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CHANGELOG
1313
* Add support for Markdown format in `Table`
1414
* Add support for `LockableTrait` in invokable commands
1515
* Deprecate returning a non-integer value from a `\Closure` function set via `Command::setCode()`
16+
* Mark `#[AsCommand]` attribute as `@final`
1617

1718
7.2
1819
---

0 commit comments

Comments
 (0)