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
4848 /**
4949 * Command constructor.
5050 *
51- * @param Console $console
51+ * @param Console|null $console
5252 */
53- public function __construct (Console $ console )
53+ public function __construct (Console $ console = null )
5454 {
55- $ this ->console = $ console ;
55+ if ($ console ) {
56+ $ this ->console = $ console ;
57+ }
5658 }
5759
5860 /**
Original file line number Diff line number Diff line change @@ -135,8 +135,9 @@ public function getLanguage() : Language
135135 public function addCommand (Command | string $ command ) : static
136136 {
137137 if (\is_string ($ command )) {
138- $ command = new $ command ($ this );
138+ $ command = new $ command ();
139139 }
140+ $ command ->setConsole ($ this );
140141 $ this ->commands [$ command ->getName ()] = $ command ;
141142 return $ this ;
142143 }
You can’t perform that action at this time.
0 commit comments