Skip to content

Commit

Permalink
BaseSniffTestCase::getSniffCode(): simplify
Browse files Browse the repository at this point in the history
This method used to need custom code as the tests did not follow the PHPCS native test naming conventions, but this was fixed quite a while ago, so the `BaseSniffTestCase::getSniffCode()` method can now defer to the PHPCS native `Common::getSniffCode()` method without issue.
  • Loading branch information
jrfnl committed Jun 9, 2024
1 parent 5a0ad8d commit cd26297
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions PHPCompatibility/Tests/BaseSniffTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Files\LocalFile;
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Util\Common;
use PHPCSUtils\BackCompat\Helper;
use Yoast\PHPUnitPolyfills\Polyfills\AssertStringContains;

Expand Down Expand Up @@ -108,12 +109,7 @@ public function resetTestVersion()
*/
protected function getSniffCode()
{
$class = \get_class($this);
$parts = \explode('\\', $class);
$sniff = \array_pop($parts);
$sniff = \str_replace('UnitTest', '', $sniff);
$category = \array_pop($parts);
return self::STANDARD_NAME . '.' . $category . '.' . $sniff;
return Common::getSniffCode(\get_class($this));
}

/**
Expand Down

0 comments on commit cd26297

Please sign in to comment.