Skip to content

Commit d54de21

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

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/Scanner/Scanner.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,12 @@ protected function saveTranslation(
7777
*/
7878
protected static function readFile(string $file): string
7979
{
80-
$length = filesize($file);
80+
$content = @file_get_contents($file);
8181

82-
if (!($fd = fopen($file, 'rb'))) {
82+
if (false === $content) {
8383
throw new Exception("Cannot read the file '$file', probably permissions");
8484
}
85-
86-
$content = $length ? fread($fd, $length) : '';
87-
fclose($fd);
88-
85+
8986
return $content;
9087
}
9188
}

0 commit comments

Comments
 (0)