Skip to content

Commit 0bbe002

Browse files
authored
fix: AsCommand properties not being set on commands (#56236)
The Symfony Command uses the AsCommand attribute to set properties on the command class. However, the properties are only set if they are identical to an empty string. The Laravel Command class overrides the properties and removes the default value which causes the properties to be null and therefore not set.
1 parent 18d3b1b commit 0bbe002

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Illuminate/Console/Command.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ class Command extends SymfonyCommand
4545
/**
4646
* The console command description.
4747
*
48-
* @var string|null
48+
* @var string
4949
*/
50-
protected $description;
50+
protected $description = '';
5151

5252
/**
5353
* The console command help text.
5454
*
5555
* @var string
5656
*/
57-
protected $help;
57+
protected $help = '';
5858

5959
/**
6060
* Indicates whether the command should be shown in the Artisan command list.
@@ -103,13 +103,13 @@ public function __construct()
103103
// Once we have constructed the command, we'll set the description and other
104104
// related properties of the command. If a signature wasn't used to build
105105
// the command we'll set the arguments and the options on this command.
106-
if (! isset($this->description)) {
107-
$this->setDescription((string) static::getDefaultDescription());
108-
} else {
109-
$this->setDescription((string) $this->description);
106+
if (! empty($this->description)) {
107+
$this->setDescription($this->description);
110108
}
111109

112-
$this->setHelp((string) $this->help);
110+
if (! empty($this->help)) {
111+
$this->setHelp($this->help);
112+
}
113113

114114
$this->setHidden($this->isHidden());
115115

0 commit comments

Comments
 (0)