Skip to content

Commit e5a077e

Browse files
jrchampGrahamCampbell
authored andcommitted
Loader: streamline isComment() with whitespace test (#212)
Streamline isComment
1 parent 3cc116a commit e5a077e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Loader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ protected function readLinesFromFile($filePath)
147147
*/
148148
protected function isComment($line)
149149
{
150-
return strpos(ltrim($line), '#') === 0;
150+
$line = ltrim($line);
151+
152+
return isset($line[0]) && $line[0] === '#';
151153
}
152154

153155
/**

tests/fixtures/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ BAR=baz
33
SPACED=with spaces
44

55
NULL=
6+

0 commit comments

Comments
 (0)