Skip to content

Commit

Permalink
only read file once (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadigennadigennadi authored May 24, 2023
1 parent 4c65206 commit 84d577a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Supportive/File/FileReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ final class FileReader
*/
public static function read(string $fileName): string
{
if (!is_file($fileName)) {
throw CouldNotReadFileException::fromFilename($fileName);
}
$contents = @file_get_contents($fileName);

if (false === $contents) {
throw CouldNotReadFileException::fromFilename($fileName);
}
Expand Down

0 comments on commit 84d577a

Please sign in to comment.