Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug #19532 : The PSR-2 standard don't recognize Null in class n…

…ames
  • Loading branch information...
commit d2b335091060995c6bcba23301f2f63e9f666ee3 1 parent 7985e9b
@gsherwood gsherwood authored
View
5 CodeSniffer/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php
@@ -75,6 +75,11 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
return;
}
+ // Class or namespace?
+ if ($tokens[($stackPtr - 1)]['code'] === T_NS_SEPARATOR) {
+ return;
+ }
+
$keyword = $tokens[$stackPtr]['content'];
if (strtolower($keyword) !== $keyword) {
$error = 'TRUE, FALSE and NULL must be lowercase; expected "%s" but found "%s"';
View
5 CodeSniffer/Standards/Generic/Sniffs/PHP/UpperCaseConstantSniff.php
@@ -66,6 +66,11 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
return;
}
+ // Class or namespace?
+ if ($tokens[($stackPtr - 1)]['code'] === T_NS_SEPARATOR) {
+ return;
+ }
+
$keyword = $tokens[$stackPtr]['content'];
if (strtoupper($keyword) !== $keyword) {
$error = 'TRUE, FALSE and NULL must be uppercase; expected "%s" but found "%s"';
View
2  CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
@@ -50,4 +50,6 @@ if ($variable === Null) { }
$x = new stdClass();
$x->NULL = 7;
+use Zend\Log\Writer\NULL as NullWriter;
+new \Zend\Log\Writer\NULL()
?>
View
3  CodeSniffer/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
@@ -50,4 +50,7 @@ if ($variable === Null) { }
$x = new stdClass();
$x->null = 7;
+use Zend\Log\Writer\Null as NullWriter;
+new \Zend\Log\Writer\Null()
+
?>
View
1  package.xml
@@ -50,6 +50,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed undefined variable error in PEAR FunctionCallSignatureSniff for lines with no indent
- Fixed bug #19502 : Generic.Files.LineEndingsSniff fails if no new-lines in file
- Fixed bug #19508 : switch+return: Closing brace indented incorrectly
+ - Fixed bug #19532 : The PSR-2 standard don't recognize Null in class names
</notes>
<contents>
<dir name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.