Skip to content

Commit

Permalink
Guard against missing compact variable position
Browse files Browse the repository at this point in the history
  • Loading branch information
sirbrillig committed Dec 1, 2024
1 parent 445ed17 commit a792e23
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,8 @@ protected function processCompact(File $phpcsFile, $stackPtr)
if ($currScope === null) {
continue;
}
$this->markVariableReadAndWarnIfUndefined($phpcsFile, $variable->name, $variable->firstRead, $currScope);
$variablePosition = $variable->firstRead ? $variable->firstRead : $stackPtr;
$this->markVariableReadAndWarnIfUndefined($phpcsFile, $variable->name, $variablePosition, $currScope);
}
}

Expand Down

0 comments on commit a792e23

Please sign in to comment.