File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,13 @@ abstract class Command
48
48
/**
49
49
* Command constructor.
50
50
*
51
- * @param Console $console
51
+ * @param Console|null $console
52
52
*/
53
- public function __construct (Console $ console )
53
+ public function __construct (Console $ console = null )
54
54
{
55
- $ this ->console = $ console ;
55
+ if ($ console ) {
56
+ $ this ->console = $ console ;
57
+ }
56
58
}
57
59
58
60
/**
Original file line number Diff line number Diff line change @@ -135,8 +135,9 @@ public function getLanguage() : Language
135
135
public function addCommand (Command | string $ command ) : static
136
136
{
137
137
if (\is_string ($ command )) {
138
- $ command = new $ command ($ this );
138
+ $ command = new $ command ();
139
139
}
140
+ $ command ->setConsole ($ this );
140
141
$ this ->commands [$ command ->getName ()] = $ command ;
141
142
return $ this ;
142
143
}
You can’t perform that action at this time.
0 commit comments