diff --git a/composer.json b/composer.json index f6ca9ec..e75f3c2 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ }, "require": { "php": "^8.1", - "doctrine/coding-standard": "^11.0" + "doctrine/coding-standard": "^11.0", + "slevomat/coding-standard": "^8.9.2" }, "require-dev": { "phpstan/extension-installer": "^1.2", diff --git a/tests/TestCase.php b/tests/TestCase.php index e632c52..126da5f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,6 +6,8 @@ use SlevomatCodingStandard\Sniffs\TestCase as SlevomatTestCase; +use function assert; +use function class_exists; use function str_replace; use function strlen; use function substr; @@ -14,6 +16,9 @@ abstract class TestCase extends SlevomatTestCase { protected static function getSniffClassName(): string { - return str_replace('\\Tests\\', '\\', substr(static::class, 0, -strlen('Test'))); + $class = str_replace('\\Tests\\', '\\', substr(static::class, 0, -strlen('Test'))); + assert(class_exists($class)); + + return $class; } }