File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 2323use PHPStan \DependencyInjection \LoaderFactory ;
2424use PHPStan \DependencyInjection \NeonAdapter ;
2525use PHPStan \ExtensionInstaller \GeneratedConfig ;
26+ use PHPStan \File \CouldNotReadFileException ;
2627use PHPStan \File \FileFinder ;
2728use PHPStan \File \FileHelper ;
2829use PHPStan \File \FileReader ;
@@ -316,10 +317,16 @@ public static function begin(
316317
317318 $ memoryLimitFile = $ container ->getParameter ('memoryLimitFile ' );
318319 if ($ manageMemoryLimitFile && is_file ($ memoryLimitFile )) {
319- $ memoryLimitFileContents = FileReader::read ($ memoryLimitFile );
320320 $ errorOutput ->writeLineFormatted ('PHPStan crashed in the previous run probably because of excessive memory consumption. ' );
321- $ errorOutput ->writeLineFormatted (sprintf ('It consumed around %s of memory. ' , $ memoryLimitFileContents ));
322- $ errorOutput ->writeLineFormatted ('' );
321+
322+ try {
323+ $ memoryLimitFileContents = FileReader::read ($ memoryLimitFile );
324+ $ errorOutput ->writeLineFormatted (sprintf ('It consumed around %s of memory. ' , $ memoryLimitFileContents ));
325+ $ errorOutput ->writeLineFormatted ('' );
326+ } catch (CouldNotReadFileException $ e ) {
327+ // pass
328+ }
329+
323330 $ errorOutput ->writeLineFormatted ('' );
324331 $ errorOutput ->writeLineFormatted ('To avoid this issue, allow to use more memory with the --memory-limit option. ' );
325332 @unlink ($ memoryLimitFile );
You can’t perform that action at this time.
0 commit comments