/** * Returns fixers. * * @return FixerInterface[] An array of FixerInterface */ public function getFixers() { if (null === $this->fixers) { $fixerFactory = new FixerFactory(); $fixerFactory->registerBuiltInFixers(); $fixerFactory->registerCustomFixers($this->getConfig()->getCustomFixers()); $this->fixers = $fixerFactory->useRuleSet($this->getRuleSet())->setWhitespacesConfig(new WhitespacesFixerConfig($this->config->getIndent(), $this->config->getLineEnding()))->getFixers(); if (false === $this->getRiskyAllowed()) { $riskyFixers = array_map(function (FixerInterface $fixer) { return $fixer->getName(); }, array_filter($this->fixers, function (FixerInterface $fixer) { return $fixer->isRisky(); })); if (count($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))); } } } return $this->fixers; }