Skip to content

Commit 2df5218

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SlevomatCodingStandard/Sniffs/TestCase.php

Lines changed: 10 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,15 @@ protected static function checkFile(string $filePath, array $sniffProperties = [
4445
$codeSniffer->init();
4546

4647
if (count($sniffProperties) > 0) {
48+
if (version_compare(Config::VERSION, '3.8.0', '>=')) {
49+
foreach ($sniffProperties as $name => $value) {
50+
$sniffProperties[$name] = [
51+
'value' => $value,
52+
'scope' => 'sniff',
53+
];
54+
}
55+
}
56+
4757
$codeSniffer->ruleset->ruleset[self::getSniffName()]['properties'] = $sniffProperties;
4858
}
4959

0 commit comments

Comments
 (0)