You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Command/Command.php
+31-4
Original file line number
Diff line number
Diff line change
@@ -54,17 +54,27 @@ class Command
54
54
privatearray$usages = [];
55
55
private ?HelperSet$helperSet = null;
56
56
57
+
/**
58
+
* @deprecated since Symfony 7.3
59
+
*/
57
60
publicstaticfunctiongetDefaultName(): ?string
58
61
{
62
+
trigger_deprecation('symfony/console', '7.3', 'The static method "%s()" is deprecated and will be removed in Symfony 8.0, extract the command name from the "%s" attribute instead.', __METHOD__, AsCommand::class);
63
+
59
64
if ($attribute = (new \ReflectionClass(static::class))->getAttributes(AsCommand::class)) {
trigger_deprecation('symfony/console', '7.3', 'The static method "%s()" is deprecated and will be removed in Symfony 8.0, extract the command description from the "%s" attribute instead.', __METHOD__, AsCommand::class);
77
+
68
78
if ($attribute = (new \ReflectionClass(static::class))->getAttributes(AsCommand::class)) {
69
79
return$attribute[0]->newInstance()->description;
70
80
}
@@ -80,8 +90,17 @@ public static function getDefaultDescription(): ?string
if (self::class !== (new \ReflectionMethod($this, 'getDefaultName'))->getDeclaringClass()->getName()) {
96
+
trigger_deprecation('symfony/console', '7.3', 'The static method "%s::getDefaultName()" is deprecated, define the command name in the "%s" attribute instead.', static::class, AsCommand::class);
@@ -96,12 +115,20 @@ public function __construct(?string $name = null)
96
115
$this->setName($name);
97
116
}
98
117
118
+
if (self::class !== (new \ReflectionMethod($this, 'getDefaultDescription'))->getDeclaringClass()->getName()) {
119
+
trigger_deprecation('symfony/console', '7.3', 'The static method "%s::getDefaultDescription()" is deprecated, define the command description in the "%s" attribute instead.', static::class, AsCommand::class);
0 commit comments