File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,11 @@ public function getRunner(?object $application): RunnerInterface
144144
145145 if (!$ application ->getName () || !$ console ->has ($ application ->getName ())) {
146146 $ application ->setName ($ _SERVER ['argv ' ][0 ]);
147- $ console ->add ($ application );
147+ if (method_exists ($ console , 'addCommand ' )) {
148+ $ console ->addCommand ($ application );
149+ } else {
150+ $ console ->add ($ application );
151+ }
148152 }
149153
150154 $ console ->setDefaultCommand ($ application ->getName (), true );
Original file line number Diff line number Diff line change 2525 });
2626
2727 $ app = new Application ();
28- $ app ->add ($ command );
28+ if (method_exists ($ app , 'addCommand ' )) {
29+ $ app ->addCommand ($ command );
30+ } else {
31+ $ app ->add ($ command );
32+ }
2933 $ app ->setDefaultCommand ('go ' , true );
3034
3135 return $ app ;
Original file line number Diff line number Diff line change 2323 $ command ->setName ('my_command ' );
2424
2525 [$ cmd , $ args ] = $ runtime ->getResolver (require __DIR__ .'/command.php ' )->resolve ();
26- $ app ->add ($ cmd (...$ args ));
26+ if (method_exists ($ app , 'addCommand ' )) {
27+ $ app ->addCommand ($ cmd (...$ args ));
28+ } else {
29+ $ app ->add ($ cmd (...$ args ));
30+ }
2731
2832 return $ app ;
2933};
You can’t perform that action at this time.
0 commit comments