Skip to content

Commit

Permalink
Merge branch 'php-8.0/squiz-validvariablename-support-nullsafe-operat…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 2, 2020
2 parents 222ea42 + ef289d9 commit 62154b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ protected function processVariable(File $phpcsFile, $stackPtr)
}

$objOperator = $phpcsFile->findNext([T_WHITESPACE], ($stackPtr + 1), null, true);
if ($tokens[$objOperator]['code'] === T_OBJECT_OPERATOR) {
if ($tokens[$objOperator]['code'] === T_OBJECT_OPERATOR
|| $tokens[$objOperator]['code'] === T_NULLSAFE_OBJECT_OPERATOR
) {
// Check to see if we are using a variable from an object.
$var = $phpcsFile->findNext([T_WHITESPACE], ($objOperator + 1), null, true);
if ($tokens[$var]['code'] === T_STRING) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,7 @@ $anonClass = new class() {
}
};

echo $obj?->varName;
echo $obj?->var_name;
echo $obj?->varname;
echo $obj?->_varName;
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function getErrorList()
123 => 1,
138 => 1,
141 => 1,
146 => 1,
];

return $errors;
Expand Down

0 comments on commit 62154b4

Please sign in to comment.