Skip to content

Commit c4fc648

Browse files
JanTvrdikkukulich
authored andcommitted
TestCase: generate sniff name fix with CodeSniffer method
1 parent f69e252 commit c4fc648

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

SlevomatCodingStandard/Sniffs/TestCase.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PHP_CodeSniffer\Files\LocalFile;
88
use PHP_CodeSniffer\Runner;
99
use PHP_CodeSniffer\Sniffs\Sniff;
10+
use PHP_CodeSniffer\Util\Common;
1011
use ReflectionClass;
1112
use function array_map;
1213
use function array_merge;
@@ -165,21 +166,9 @@ protected static function getSniffClassName(): string
165166
return $sniffClassName;
166167
}
167168

168-
private static function getSniffName(): string
169+
protected static function getSniffName(): string
169170
{
170-
return preg_replace(
171-
[
172-
'~\\\~',
173-
'~\.Sniffs~',
174-
'~Sniff$~',
175-
],
176-
[
177-
'.',
178-
'',
179-
'',
180-
],
181-
static::getSniffClassName()
182-
);
171+
return Common::getSniffCode(static::getSniffClassName());
183172
}
184173

185174
private static function getSniffClassReflection(): ReflectionClass

0 commit comments

Comments
 (0)