@@ -71,30 +71,27 @@ public function runAnalyser(
7171 );
7272 }
7373
74- $ schedule = $ this ->scheduler ->scheduleWork ($ this ->cpuCoreCounter ->getNumberOfCpuCores (), $ files , $ debug );
75- $ mainScript = null ;
76- if (isset ($ _SERVER ['argv ' ][0 ]) && is_file ($ _SERVER ['argv ' ][0 ])) {
77- $ mainScript = $ _SERVER ['argv ' ][0 ];
78- }
74+ if (!$ debug && $ allowParallel && function_exists ('proc_open ' )) {
75+ $ schedule = $ this ->scheduler ->scheduleWork ($ this ->cpuCoreCounter ->getNumberOfCpuCores (), $ files );
76+
77+ $ mainScript = null ;
78+ if (isset ($ _SERVER ['argv ' ][0 ]) && is_file ($ _SERVER ['argv ' ][0 ])) {
79+ $ mainScript = $ _SERVER ['argv ' ][0 ];
80+ }
7981
80- if (
81- !$ debug
82- && $ allowParallel
83- && function_exists ('proc_open ' )
84- && $ mainScript !== null
85- && $ schedule ->getNumberOfProcesses () > 0
86- ) {
87- $ loop = new StreamSelectLoop ();
88- $ result = null ;
89- $ promise = $ this ->parallelAnalyser ->analyse ($ loop , $ schedule , $ mainScript , $ postFileCallback , $ projectConfigFile , $ tmpFile , $ insteadOfFile , $ input , null );
90- $ promise ->then (static function (AnalyserResult $ tmp ) use (&$ result ): void {
91- $ result = $ tmp ;
92- });
93- $ loop ->run ();
94- if ($ result === null ) {
95- throw new ShouldNotHappenException ();
82+ if (($ mainScript !== null ) && ($ schedule ->getNumberOfProcesses () > 0 )) {
83+ $ loop = new StreamSelectLoop ();
84+ $ result = null ;
85+ $ promise = $ this ->parallelAnalyser ->analyse ($ loop , $ schedule , $ mainScript , $ postFileCallback , $ projectConfigFile , $ tmpFile , $ insteadOfFile , $ input , null );
86+ $ promise ->then (static function (AnalyserResult $ tmp ) use (&$ result ): void {
87+ $ result = $ tmp ;
88+ });
89+ $ loop ->run ();
90+ if ($ result === null ) {
91+ throw new ShouldNotHappenException ();
92+ }
93+ return $ result ;
9694 }
97- return $ result ;
9895 }
9996
10097 return $ this ->analyser ->analyse (
0 commit comments