File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class Application
3939 protected $ name ;
4040
4141 /** @var string App version */
42- protected $ version = '0.0.1 ' ;
42+ protected $ version = '' ;
4343
4444 /** @var string Ascii art logo */
4545 protected $ logo = '' ;
@@ -49,7 +49,10 @@ class Application
4949 /** @var Interactor */
5050 protected $ io ;
5151
52- public function __construct (string $ name , string $ version = '' , callable $ onExit = null )
52+ /** @var callable The callable to perform exit */
53+ protected $ onExit ;
54+
55+ public function __construct (string $ name , string $ version = '0.0.1 ' , callable $ onExit = null )
5356 {
5457 $ this ->name = $ name ;
5558 $ this ->version = $ version ;
@@ -267,9 +270,9 @@ public function handle(array $argv)
267270 $ exitCode = 255 ;
268271
269272 try {
270- $ command = $ this ->parse ($ argv );
271- $ this ->doAction ($ command );
272- $ exitCode = 0 ;
273+ $ command = $ this ->parse ($ argv );
274+ $ result = $ this ->doAction ($ command );
275+ $ exitCode = \is_int ( $ result ) ? $ result : 0 ;
273276 } catch (\Throwable $ e ) {
274277 $ this ->outputHelper ()->printTrace ($ e );
275278 }
You can’t perform that action at this time.
0 commit comments