diff --git a/coder_sniffer/DrupalPractice/Sniffs/Objects/UnusedPrivateMethodSniff.php b/coder_sniffer/DrupalPractice/Sniffs/Objects/UnusedPrivateMethodSniff.php index d93b1d3f72bc0576c61eb90005db6c14010ac295..680a9832a0a490a379e56760b41cc4b30aa2bedb 100644 --- a/coder_sniffer/DrupalPractice/Sniffs/Objects/UnusedPrivateMethodSniff.php +++ b/coder_sniffer/DrupalPractice/Sniffs/Objects/UnusedPrivateMethodSniff.php @@ -77,7 +77,8 @@ class UnusedPrivateMethodSniff extends AbstractScopeSniff if ($tokens[$next]['code'] === T_OBJECT_OPERATOR) { $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; } diff --git a/tests/DrupalPractice/Objects/UnusedPrivateMethodUnitTest.inc b/tests/DrupalPractice/Objects/UnusedPrivateMethodUnitTest.inc index 796bb6ec5058885d1f144b17d4dc58a4e139dfcc..92a838a361debc34579d306073e333549cb63b99 100644 --- a/tests/DrupalPractice/Objects/UnusedPrivateMethodUnitTest.inc +++ b/tests/DrupalPractice/Objects/UnusedPrivateMethodUnitTest.inc @@ -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(); + } + }