/**
* Resolve fixers to run based on rules.
*/
private function resolveFixers()
{
$this->fixers = $this->fixerFactory->useRuleSet($this->ruleSet)->getFixers();
if (true === $this->allowRisky) {
return;
}
$riskyFixers = array_map(function (FixerInterface $fixer) {
return $fixer->getName();
}, array_filter($this->fixers, function (FixerInterface $fixer) {
return $fixer->isRisky();
}));
if (!empty($riskyFixers)) {
throw new InvalidConfigurationException(sprintf('The rules contain risky fixers (%s), but they are not allowed to run. Perhaps you forget to use --allow-risky option?', implode(', ', $riskyFixers)));
}
}