Skip to content
Snippets Groups Projects
Unverified Commit 496c1301 authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

fix(UnusedPrivateMethod): Fix case insensitivity og PHP method calls (#3398208)

parent 5eccb7de
Branches
Tags
No related merge requests found
...@@ -77,7 +77,8 @@ class UnusedPrivateMethodSniff extends AbstractScopeSniff ...@@ -77,7 +77,8 @@ class UnusedPrivateMethodSniff extends AbstractScopeSniff
if ($tokens[$next]['code'] === T_OBJECT_OPERATOR) { if ($tokens[$next]['code'] === T_OBJECT_OPERATOR) {
$call = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true); $call = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
if ($call === false || $tokens[$call]['content'] !== $methodName) { // PHP method calls are case insensitive.
if ($call === false || strcasecmp($tokens[$call]['content'], $methodName) !== 0) {
continue; continue;
} }
......
...@@ -16,4 +16,18 @@ class Test { ...@@ -16,4 +16,18 @@ class Test {
} }
/**
* Method is called from somewhere in the class.
*/
private function isUsed() {
}
/**
* Call method with different upper/lower case.
*/
public function doCalls() {
$this->IsUsEd();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment