Skip to content

Commit eb92adb

Browse files
committed
TestCase: update for new Ruleset::$properties format
Refs: * squizlabs/PHP_CodeSniffer#3629 * squizlabs/PHP_CodeSniffer#3489
1 parent d315011 commit eb92adb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

SlevomatCodingStandard/Sniffs/TestCase.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use function strlen;
2222
use function strpos;
2323
use function substr;
24+
use function version_compare;
2425
use const PHP_EOL;
2526

2627
/**
@@ -44,6 +45,16 @@ protected static function checkFile(string $filePath, array $sniffProperties = [
4445
$codeSniffer->init();
4546

4647
if (count($sniffProperties) > 0) {
48+
/** @phpstan-ignore-next-line */
49+
if (version_compare(Config::VERSION, '3.8.0', '>=')) {
50+
foreach ($sniffProperties as $name => $value) {
51+
$sniffProperties[$name] = [
52+
'value' => $value,
53+
'scope' => 'sniff',
54+
];
55+
}
56+
}
57+
4758
$codeSniffer->ruleset->ruleset[self::getSniffName()]['properties'] = $sniffProperties;
4859
}
4960

0 commit comments

Comments
 (0)