File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 22
22
use function array_sum ;
23
23
use function count ;
24
24
use function defined ;
25
+ use function ini_get ;
25
26
use function is_string ;
26
27
use function max ;
27
28
use function memory_get_usage ;
28
29
use function parse_url ;
29
30
use function sprintf ;
31
+ use function str_contains ;
30
32
use const PHP_URL_PORT ;
31
33
32
34
class ParallelAnalyser
@@ -204,7 +206,26 @@ public function analyse(
204
206
return ;
205
207
}
206
208
207
- $ internalErrors [] = sprintf ('Child process error (exit code %d): %s ' , $ exitCode , $ output );
209
+ $ memoryLimitMessage = 'PHPStan process crashed because it reached configured PHP memory limit ' ;
210
+ if (str_contains ($ output , $ memoryLimitMessage )) {
211
+ foreach ($ internalErrors as $ internalError ) {
212
+ if (!str_contains ($ internalError , $ memoryLimitMessage )) {
213
+ continue ;
214
+ }
215
+
216
+ return ;
217
+ }
218
+ $ internalErrors [] = sprintf (sprintf (
219
+ "<error>Child process error</error>: %s: %s \n%s \n" ,
220
+ $ memoryLimitMessage ,
221
+ ini_get ('memory_limit ' ),
222
+ 'Increase your memory limit in php.ini or run PHPStan with --memory-limit CLI option. ' ,
223
+ ));
224
+ $ internalErrorsCount ++;
225
+ return ;
226
+ }
227
+
228
+ $ internalErrors [] = sprintf ('<error>Child process error</error> (exit code %d): %s ' , $ exitCode , $ output );
208
229
$ internalErrorsCount ++;
209
230
});
210
231
$ this ->processPool ->attachProcess ($ processIdentifier , $ process );
You can’t perform that action at this time.
0 commit comments