Skip to content

Commit de13916

Browse files
committed
BadFunctions/EasyRFI: use the build-in PHPCS functionality [2]
The PHPCS native `PHP_CodeSniffer\Util\Tokens` class contains a number of useful token groups. For this particular sniff, the `Tokens::$includeTokens` applies and contains all the relevant tokens. It is generally a good idea to use the build-in token groups, as when something would change in how PHP and/or PHPCS tokenizes certain constructs, those groups will be updated too.
1 parent 437c7f6 commit de13916

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Security/Sniffs/BadFunctions/EasyRFISniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use PHP_CodeSniffer\Sniffs\Sniff;
55
use PHP_CodeSniffer\Files\File;
6-
6+
use PHP_CodeSniffer\Util\Tokens;
77

88
class EasyRFISniff implements Sniff {
99

@@ -25,7 +25,7 @@ public function register() {
2525
$this->search += \PHP_CodeSniffer\Util\Tokens::$bracketTokens;
2626
$this->search += \PHPCS_SecurityAudit\Security\Sniffs\Utils::$staticTokens;
2727

28-
return array(T_INCLUDE, T_INCLUDE_ONCE, T_REQUIRE, T_REQUIRE_ONCE);
28+
return Tokens::$includeTokens;
2929
}
3030

3131
/**

0 commit comments

Comments
 (0)