File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ public function execute(
210210 return ;
211211 }
212212 // Handle subcommands
213- if (!empty ($ rawArgs )) {
213+ if (!empty ($ rawArgs ) && ! empty ( $ this -> getSubCommands ()) ) {
214214 $ key = strtolower (array_shift ($ rawArgs ));
215215 foreach ($ this ->getSubCommands () as $ sub ) {
216216 $ name = $ sub ->getName ();
@@ -220,6 +220,7 @@ public function execute(
220220 return ;
221221 }
222222 }
223+ array_unshift ($ rawArgs , $ key );
223224 }
224225
225226 // Check constraints
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ public function withPermission(string $permission): self {
126126 */
127127 public function addConstraint (Constraint $ constraint ): self {
128128 $ this ->config ['constraints ' ][] = $ constraint ;
129+ parent ::addConstraint ($ constraint );
129130 return $ this ;
130131 }
131132
@@ -137,6 +138,7 @@ public function addConstraint(Constraint $constraint): self {
137138 */
138139 public function addArgument (Argument $ argument ): self {
139140 $ this ->config ['arguments ' ][] = $ argument ;
141+ parent ::addArgument ($ argument );
140142 return $ this ;
141143 }
142144
@@ -148,6 +150,7 @@ public function addArgument(Argument $argument): self {
148150 */
149151 public function addSubCommand (SubCommand $ subCommand ): self {
150152 $ this ->config ['subcommands ' ][] = $ subCommand ;
153+ parent ::addSubCommand ($ subCommand );
151154 return $ this ;
152155 }
153156
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ public function setPermission(string $permission): self {
111111 */
112112 public function addConstraint (Constraint $ constraint ): self {
113113 $ this ->config ['constraints ' ][] = $ constraint ;
114+ parent ::addConstraint ($ constraint );
114115 return $ this ;
115116 }
116117
@@ -122,6 +123,7 @@ public function addConstraint(Constraint $constraint): self {
122123 */
123124 public function addArgument (Argument $ argument ): self {
124125 $ this ->config ['arguments ' ][] = $ argument ;
126+ parent ::addArgument ($ argument );
125127 return $ this ;
126128 }
127129
You can’t perform that action at this time.
0 commit comments