Skip to content

Commit

Permalink
TestCase: update for new Ruleset::$properties format
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl authored and kukulich committed Dec 11, 2023
1 parent 9afda41 commit ad4eab6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SlevomatCodingStandard/Sniffs/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use function strlen;
use function strpos;
use function substr;
use function version_compare;
use const PHP_EOL;

/**
Expand All @@ -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;
}

Expand Down

0 comments on commit ad4eab6

Please sign in to comment.