Skip to content

[Command] Make #[AsCommand] attribute class final #60959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE-8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ AssetMapper
Console
-------

* The `AsCommand` attribute class is now `final`
* Remove methods `Command::getDefaultName()` and `Command::getDefaultDescription()` in favor of the `#[AsCommand]` attribute

*Before*
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Console/Attribute/AsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@

/**
* Service tag to autoconfigure commands.
*
* @final since Symfony 7.3
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class AsCommand
final class AsCommand
{
/**
* @param string $name The name of the command, used when calling it (i.e. "cache:clear")
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
8.0
---

* Make `AsCommand` attribute class `final`
* Remove methods `Command::getDefaultName()` and `Command::getDefaultDescription()` in favor of the `#[AsCommand]` attribute
* Ensure closures set via `Command::setCode()` method have proper parameter and return types
* Add method `isSilent()` to `OutputInterface`
Expand Down
Loading