Skip to content

Commit 41a426c

Browse files
authored
Merge pull request #600 from PHPCSStandards/feature/generic-lowercasekeyword-remove-redundant-targets
Generic/LowerCaseKeyword: remove some redundant code
2 parents a30d7bd + 59905db commit 41a426c

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@ public function register()
2929
$targets += [
3030
T_ANON_CLASS => T_ANON_CLASS,
3131
T_CLOSURE => T_CLOSURE,
32-
T_EMPTY => T_EMPTY,
3332
T_ENUM_CASE => T_ENUM_CASE,
34-
T_EVAL => T_EVAL,
35-
T_ISSET => T_ISSET,
3633
T_MATCH_DEFAULT => T_MATCH_DEFAULT,
3734
T_PARENT => T_PARENT,
3835
T_SELF => T_SELF,
39-
T_UNSET => T_UNSET,
4036
];
4137

4238
return $targets;

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ new Class {};
4848
new clasS extends stdClass {};
4949
new class {};
5050

51+
if (isset($a) && !empty($a)) { unset($a); }
52+
if (ISSET($a) && !Empty($a)) { UnSeT($a); }
53+
eval('foo');
54+
eVaL('foo');
55+
5156
__HALT_COMPILER(); // An exception due to phar support.
5257
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ new class {};
4848
new class extends stdClass {};
4949
new class {};
5050

51+
if (isset($a) && !empty($a)) { unset($a); }
52+
if (isset($a) && !empty($a)) { unset($a); }
53+
eval('foo');
54+
eval('foo');
55+
5156
__HALT_COMPILER(); // An exception due to phar support.
5257
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function getErrorList()
5050
44 => 1,
5151
47 => 1,
5252
48 => 1,
53+
52 => 3,
54+
54 => 1,
5355
];
5456

5557
}//end getErrorList()

0 commit comments

Comments
 (0)