Skip to content

Commit 3c45a8c

Browse files
authored
Replace fopen/fread with file_get_contents in Loader class
Fixes #257
1 parent ea6d0c5 commit 3c45a8c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/Loader/Loader.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ protected function createTranslation(?string $context, string $original, string
4545
*/
4646
protected static function readFile(string $file): string
4747
{
48-
$length = filesize($file);
49-
50-
if (!($fd = fopen($file, 'rb'))) {
48+
$content = @file_get_contents($file);
49+
50+
if (false === $content) {
5151
throw new Exception("Cannot read the file '$file', probably permissions");
5252
}
5353

54-
$content = $length ? fread($fd, $length) : '';
55-
fclose($fd);
56-
5754
return $content;
5855
}
5956
}

0 commit comments

Comments
 (0)