Skip to content

Commit

Permalink
Merge branch 'php-8.0/zend-validvariablename-support-nullsafe-operato…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 2, 2020
2 parents 82efb1e + 49a8d01 commit 4efd0ad
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 @@ -116,3 +116,7 @@ $anonClass = new class() {
$bar_foo = 3;
}
};

echo $obj?->varName;
echo $obj?->var_name;
echo $obj?->varName;
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function getErrorList()
99 => 1,
113 => 1,
116 => 1,
121 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 4efd0ad

Please sign in to comment.