Skip to content

Commit 22c22d1

Browse files
committed
Handle static variable function calls
1 parent bc3db48 commit 22c22d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@ protected function checkForStaticMember(File $phpcsFile, $stackPtr, $varName, $c
524524
if (! in_array($tokens[$classNamePtr]['code'], $staticReferences, true)) {
525525
return false;
526526
}
527+
// "When calling static methods, the function call is stronger than the
528+
// static property operator" so look for a function call.
529+
$parenPointer = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr, $stackPtr + 2);
530+
if ($parenPointer) {
531+
return false;
532+
}
527533
return true;
528534
}
529535

0 commit comments

Comments
 (0)