Skip to content

Commit

Permalink
Merge pull request #600 from PHPCSStandards/feature/generic-lowercase…
Browse files Browse the repository at this point in the history
…keyword-remove-redundant-targets

Generic/LowerCaseKeyword: remove some redundant code
  • Loading branch information
jrfnl authored Aug 17, 2024
2 parents a30d7bd + 59905db commit 41a426c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ public function register()
$targets += [
T_ANON_CLASS => T_ANON_CLASS,
T_CLOSURE => T_CLOSURE,
T_EMPTY => T_EMPTY,
T_ENUM_CASE => T_ENUM_CASE,
T_EVAL => T_EVAL,
T_ISSET => T_ISSET,
T_MATCH_DEFAULT => T_MATCH_DEFAULT,
T_PARENT => T_PARENT,
T_SELF => T_SELF,
T_UNSET => T_UNSET,
];

return $targets;
Expand Down
5 changes: 5 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ new Class {};
new clasS extends stdClass {};
new class {};

if (isset($a) && !empty($a)) { unset($a); }
if (ISSET($a) && !Empty($a)) { UnSeT($a); }
eval('foo');
eVaL('foo');

__HALT_COMPILER(); // An exception due to phar support.
function
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ new class {};
new class extends stdClass {};
new class {};

if (isset($a) && !empty($a)) { unset($a); }
if (isset($a) && !empty($a)) { unset($a); }
eval('foo');
eval('foo');

__HALT_COMPILER(); // An exception due to phar support.
function
2 changes: 2 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function getErrorList()
44 => 1,
47 => 1,
48 => 1,
52 => 3,
54 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 41a426c

Please sign in to comment.