diff --git a/src/File/FileReader.php b/src/File/FileReader.php index 90477570e3..5a0c5570fc 100644 --- a/src/File/FileReader.php +++ b/src/File/FileReader.php @@ -9,6 +9,9 @@ class FileReader public static function read(string $fileName): string { + if (!is_file($fileName)) { + throw new \PHPStan\File\CouldNotReadFileException($fileName); + } $contents = @file_get_contents($fileName); if ($contents === false) { throw new \PHPStan\File\CouldNotReadFileException($fileName);