Skip to content

Commit

Permalink
Fixed bug #18762 : Incorrect handling of define and constant in Upper…
Browse files Browse the repository at this point in the history
…CaseConstantNameSniff

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CodeSniffer/trunk@316509 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
gsherwood committed Sep 12, 2011
1 parent ba48166 commit 407b10d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)

// Make sure this is not a method call.
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR) {
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR
|| $tokens[$prev]['code'] === T_DOUBLE_COLON
) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ class ConstTest {
echo constant('self::tester');
}
}

class A {
public static function constant($x) {}
}

A::constant('anything-not-in-uppercase');
?>
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #18670 : UpperCaseConstantNameSniff fails on dynamic retrieval of class constant
- Fixed bug #18709 : Code sniffer sniffs file if even if it's in --ignore
-- Thanks to Artem Lopata for the patch
- Fixed bug #18762 : Incorrect handling of define and constant in UpperCaseConstantNameSniff
-- Thanks to Thomas Baker for the patch
- Fixed bug #18769 : CSS Tokenizer doesn't replace T_BREAK tokens inside some styles
</notes>
<contents>
Expand Down

0 comments on commit 407b10d

Please sign in to comment.