Skip to content
Browse files

Squiz LowercasePHPFunctionSniff no longer throws errors for the limit…

…ed set of PHP keywords it was checking
  • Loading branch information...
1 parent db5e7ff commit eb4b29955bf4e9944edf359680c94eb9cf1a7018 @gsherwood gsherwood committed Mar 20, 2013
View
36 CodeSniffer/Standards/Squiz/Sniffs/PHP/LowercasePHPFunctionsSniff.php
@@ -38,26 +38,7 @@ class Squiz_Sniffs_PHP_LowercasePHPFunctionsSniff implements PHP_CodeSniffer_Sni
*/
public function register()
{
- return array(
- T_ISSET,
- T_ECHO,
- T_PRINT,
- T_RETURN,
- T_BREAK,
- T_CONTINUE,
- T_EMPTY,
- T_EVAL,
- T_EXIT,
- T_LIST,
- T_UNSET,
- T_INCLUDE,
- T_INCLUDE_ONCE,
- T_REQUIRE,
- T_REQUIRE_ONCE,
- T_NEW,
- T_DECLARE,
- T_STRING,
- );
+ return array(T_STRING);
}//end register()
@@ -75,21 +56,6 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
- if ($tokens[$stackPtr]['code'] !== T_STRING) {
- $content = $tokens[$stackPtr]['content'];
- if ($content !== strtolower($content)) {
- $error = '%s keyword must be lowercase; expected "%s" but found "%s"';
- $data = array(
- strtoupper($content),
- strtolower($content),
- $content,
- );
- $phpcsFile->addError($error, $stackPtr, 'KeywordUppercase', $data);
- }
-
- return;
- }
-
// Make sure this is a function call.
$next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
if ($next === false) {
View
25 CodeSniffer/Standards/Squiz/Tests/PHP/LowercasePHPFunctionsUnitTest.inc
@@ -1,29 +1,4 @@
<?php
-Include $path;
-Include_Once $path;
-Require $path;
-Require_Once $path;
-
-List($one, $two) = $array;
-if (IsSet($one)) {
- Echo 'hi';
- Print('hi');
- if (Empty($two)) {
- Break;
- }
- Unset($array);
- Continue;
-}
-
-$obj = New MyObj();
-Eval($code);
-Return false;
-Exit();
-Die();
-
-Declare(ticks=1) {
-}
-
if (Function_Exists('myFunction') === TRUE) {
$retval = MyFunction(true);
$keys = Array_Keys($array);
View
22 CodeSniffer/Standards/Squiz/Tests/PHP/LowercasePHPFunctionsUnitTest.php
@@ -43,26 +43,8 @@ class Squiz_Tests_PHP_LowercasePHPFunctionsUnitTest extends AbstractSniffUnitTes
public function getErrorList()
{
return array(
- 2 => 1,
- 3 => 1,
- 4 => 1,
- 5 => 1,
- 7 => 1,
- 8 => 1,
- 9 => 1,
- 10 => 1,
- 11 => 1,
- 12 => 1,
- 14 => 1,
- 15 => 1,
- 18 => 1,
- 19 => 1,
- 20 => 1,
- 21 => 1,
- 22 => 1,
- 24 => 1,
- 27 => 1,
- 29 => 1,
+ 2 => 1,
+ 4 => 1,
);
}//end getErrorList()

0 comments on commit eb4b299

Please sign in to comment.
Something went wrong with that request. Please try again.