File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 33
44use  Composer \XdebugHandler \XdebugHandler ;
55use  PHPStan \Command \AnalyseCommand ;
6- use  Symfony \Component \Console \Exception \CommandNotFoundException ;
76
87gc_disable (); // performance boost 
98
@@ -36,10 +35,5 @@ $application = new \Symfony\Component\Console\Application(
3635'PHPStan - PHP Static Analysis Tool ' ,
3736$ version
3837);
39- $ application ->setCatchExceptions (false );
4038$ application ->add (new  AnalyseCommand ());
41- try  {
42-  $ application ->run ();
43- } catch  (CommandNotFoundException   $ exception ) {
44-  echo  $ exception ->getMessage ()."\n" ;
45- }
39+ $ application ->run ();
Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ public function getAliases(): array
4747return  ['analyze ' ];
4848}
4949
50+ protected  function  initialize (InputInterface   $ input , OutputInterface   $ output ): void 
51+ {
52+ if  ((bool ) $ input ->getOption ('debug ' )) {
53+ $ this  ->getApplication ()->setCatchExceptions (false );
54+ }
55+ }
56+ 
5057protected  function  execute (InputInterface   $ input , OutputInterface   $ output ): int 
5158{
5259$ errOutput  = $ output  instanceof  ConsoleOutputInterface ? $ output ->getErrorOutput () : $ output ;
                                 You can’t perform that action at this time. 
               
                  
0 commit comments