From ad4eab6f2cf9aa099c8853e4e3a250a9ae5fb4bd Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 9 Dec 2023 05:34:00 +0100 Subject: [PATCH] TestCase: update for new Ruleset::$properties format Refs: * https://github.com/squizlabs/PHP_CodeSniffer/pull/3629 * https://github.com/squizlabs/PHP_CodeSniffer/issues/3489 --- SlevomatCodingStandard/Sniffs/TestCase.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SlevomatCodingStandard/Sniffs/TestCase.php b/SlevomatCodingStandard/Sniffs/TestCase.php index 74d440f94..b418c788b 100644 --- a/SlevomatCodingStandard/Sniffs/TestCase.php +++ b/SlevomatCodingStandard/Sniffs/TestCase.php @@ -21,6 +21,7 @@ use function strlen; use function strpos; use function substr; +use function version_compare; use const PHP_EOL; /** @@ -44,6 +45,16 @@ protected static function checkFile(string $filePath, array $sniffProperties = [ $codeSniffer->init(); if (count($sniffProperties) > 0) { + /** @phpstan-ignore-next-line */ + if (version_compare(Config::VERSION, '3.8.0', '>=')) { + foreach ($sniffProperties as $name => $value) { + $sniffProperties[$name] = [ + 'value' => $value, + 'scope' => 'sniff', + ]; + } + } + $codeSniffer->ruleset->ruleset[self::getSniffName()]['properties'] = $sniffProperties; }