Skip to content

Commit b9e0740

Browse files
committed
Fix an issue with setting file extensions. Make sure to return a blank array when the file does not actually contain any lines, but the file does exist.
1 parent e853ac0 commit b9e0740

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

classes/scanner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct($projectPath, $extensions = null) {
4646
}
4747
$this->projectPath = $projectPath;
4848

49-
if (!is_null($extensions)) {
49+
if (is_array($extensions)) {
5050
$this->setFileExtensions($extensions);
5151
}
5252

@@ -98,9 +98,9 @@ public function scanNextFile() {
9898
}
9999
$file = $_file['value'];
100100

101-
$lines = file($file);
101+
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
102102
if ($lines === false) {
103-
return false;
103+
$lines = [];
104104
}
105105
return $lines;
106106
}

mar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ static public function getRealPath($path) {
185185
}
186186
}
187187
$mar = new \mar\main();
188-
?>
188+
?>

0 commit comments

Comments
 (0)