Skip to content

Commit 1a9128e

Browse files
committed
Squiz/ClassFileName: minor stability tweak
Use the predefined `Tokens::$ooScopeTokens` array to automatically benefit from new OO structures being added to that list.
1 parent 6de24b1 commit 1a9128e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use PHP_CodeSniffer\Files\File;
1313
use PHP_CodeSniffer\Sniffs\Sniff;
14+
use PHP_CodeSniffer\Util\Tokens;
1415

1516
class ClassFileNameSniff implements Sniff
1617
{
@@ -23,12 +24,10 @@ class ClassFileNameSniff implements Sniff
2324
*/
2425
public function register()
2526
{
26-
return [
27-
T_CLASS,
28-
T_INTERFACE,
29-
T_TRAIT,
30-
T_ENUM,
31-
];
27+
$targets = Tokens::$ooScopeTokens;
28+
unset($targets[T_ANON_CLASS]);
29+
30+
return $targets;
3231

3332
}//end register()
3433

0 commit comments

Comments
 (0)