Skip to content

Commit

Permalink
Files/FileList::current() - Check files array key
Browse files Browse the repository at this point in the history
For some unknown reason, doing git precommit hook with husky and
PHP 7.4, FileList method `current` tries to access undefined array
index and throws RuntimeException.

After adding the `isset($this->files[$path]) === false` check,
linting works as expected.

Remove redundant check
  • Loading branch information
ivuorinen authored and gsherwood committed Jan 13, 2021
1 parent 4af4d84 commit 072042a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Files/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function rewind()
public function current()
{
$path = key($this->files);
if ($this->files[$path] === null) {
if (isset($this->files[$path]) === false) {
$this->files[$path] = new LocalFile($path, $this->ruleset, $this->config);
}

Expand Down

0 comments on commit 072042a

Please sign in to comment.