private function validateRules(array $rules)
    {
        /**
         * Create a ruleset that contains all configured rules, even when they originally have been disabled.
         *
         * @see RuleSet::resolveSet()
         */
        $ruleSet = [];
        foreach ($rules as $key => $value) {
            if (\is_int($key)) {
                throw new InvalidConfigurationException(sprintf('Missing value for "%s" rule/set.', $value));
            }

            $ruleSet[$key] = true;
        }
        $ruleSet = new RuleSet($ruleSet);

        /** @var string[] $configuredFixers */
        $configuredFixers = array_keys($ruleSet->getRules());

        $fixers = $this->createFixerFactory()->getFixers();

        /** @var string[] $availableFixers */
        $availableFixers = array_map(static function (FixerInterface $fixer) {
            return $fixer->getName();
        }, $fixers);

        $unknownFixers = array_diff(
            $configuredFixers,
            $availableFixers
        );

        if (\count($unknownFixers)) {
            $matcher = new WordMatcher($availableFixers);

            $message = 'The rules contain unknown fixers: ';
            foreach ($unknownFixers as $unknownFixer) {
                $alternative = $matcher->match($unknownFixer);
                $message .= sprintf(
                    '"%s"%s, ',
                    $unknownFixer,
                    null === $alternative ? '' : ' (did you mean "'.$alternative.'"?)'
                );
            }

            throw new InvalidConfigurationException(substr($message, 0, -2).'.');
        }

        foreach ($fixers as $fixer) {
            $fixerName = $fixer->getName();
            if (isset($rules[$fixerName]) && $fixer instanceof DeprecatedFixerInterface) {
                $successors = $fixer->getSuccessorsNames();
                $messageEnd = [] === $successors
                    ? sprintf(' and will be removed in version %d.0.', (int) Application::VERSION + 1)
                    : sprintf('. Use %s instead.', str_replace('`', '"', Utils::naturalLanguageJoinWithBackticks($successors)));

                $message = "Rule \"{$fixerName}\" is deprecated{$messageEnd}";

                if (getenv('PHP_CS_FIXER_FUTURE_MODE')) {
                    throw new \RuntimeException("{$message} This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.");
                }

                @trigger_error($message, E_USER_DEPRECATED);
            }
        }
    }
private function validateRules(array $rules)
    {
        /**
         * Create a ruleset that contains all configured rules, even when they originally have been disabled.
         *
         * @see RuleSet::resolveSet()
         */
        $ruleSet = [];
        foreach ($rules as $key => $value) {
            if (\is_int($key)) {
                throw new InvalidConfigurationException(sprintf('Missing value for "%s" rule/set.', $value));
            }

            $ruleSet[$key] = true;
        }
        $ruleSet = new RuleSet($ruleSet);

        /** @var string[] $configuredFixers */
        $configuredFixers = array_keys($ruleSet->getRules());

        $fixers = $this->createFixerFactory()->getFixers();

        /** @var string[] $availableFixers */
        $availableFixers = array_map(static function (FixerInterface $fixer) {
            return $fixer->getName();
        }, $fixers);

        $unknownFixers = array_diff(
            $configuredFixers,
            $availableFixers
        );

        if (\count($unknownFixers)) {
            $matcher = new WordMatcher($availableFixers);

            $message = 'The rules contain unknown fixers: ';
            foreach ($unknownFixers as $unknownFixer) {
                $alternative = $matcher->match($unknownFixer);
                $message .= sprintf(
                    '"%s"%s, ',
                    $unknownFixer,
                    null === $alternative ? '' : ' (did you mean "'.$alternative.'"?)'
                );
            }

            throw new InvalidConfigurationException(substr($message, 0, -2).'.');
        }

        foreach ($fixers as $fixer) {
            $fixerName = $fixer->getName();
            if (isset($rules[$fixerName]) && $fixer instanceof DeprecatedFixerInterface) {
                $successors = $fixer->getSuccessorsNames();
                $messageEnd = [] === $successors
                    ? sprintf(' and will be removed in version %d.0.', (int) Application::VERSION + 1)
                    : sprintf('. Use %s instead.', str_replace('`', '"', Utils::naturalLanguageJoinWithBackticks($successors)));

                $message = "Rule \"{$fixerName}\" is deprecated{$messageEnd}";

                if (getenv('PHP_CS_FIXER_FUTURE_MODE')) {
                    throw new \RuntimeException("{$message} This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.");
                }

                @trigger_error($message, E_USER_DEPRECATED);
            }
        }
    }
@param array $rules

@throws InvalidConfigurationException