|
@@ -345,25 +345,6 @@ final class ConfigurationResolver
|
|
|
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)));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- foreach ($this->fixers as $fixer) {
|
|
|
- if ($fixer instanceof DeprecatedFixerInterface) {
|
|
|
- $successors = $fixer->getSuccessorsNames();
|
|
|
- $message = sprintf(
|
|
|
- 'Fixer `%s` is deprecated%s',
|
|
|
- $fixer->getName(),
|
|
|
- [] === $successors
|
|
|
- ? ' and will be removed on next major version.'
|
|
|
- : sprintf(', use %s instead.', Utils::naturalLanguageJoinWithBackticks($successors))
|
|
|
- );
|
|
|
-
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
return $this->fixers;
|
|
@@ -445,14 +426,13 @@ final class ConfigurationResolver
|
|
|
implode('", "', $progressTypes)
|
|
|
));
|
|
|
} elseif (in_array($progressType, ['estimating', 'estimating-max', 'run-in'], true)) {
|
|
|
+ $message = 'Passing `estimating`, `estimating-max` or `run-in` is deprecated and will not be supported in 3.0, use `none` or `dots` instead.';
|
|
|
+
|
|
|
if (getenv('PHP_CS_FIXER_FUTURE_MODE')) {
|
|
|
- throw new \InvalidArgumentException('Passing `estimating`, `estimating-max` or `run-in` is deprecated and will not be supported in 3.0, use `none` or `dots` instead. This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.');
|
|
|
+ throw new \InvalidArgumentException("{$message} This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.");
|
|
|
}
|
|
|
|
|
|
- @trigger_error(
|
|
|
- 'Passing `estimating`, `estimating-max` or `run-in` is deprecated and will not be supported in 3.0, use `none` or `dots` instead.',
|
|
|
- E_USER_DEPRECATED
|
|
|
- );
|
|
|
+ @trigger_error($message, E_USER_DEPRECATED);
|
|
|
}
|
|
|
|
|
|
$this->progress = $progressType;
|
|
@@ -749,10 +729,12 @@ final class ConfigurationResolver
|
|
|
/** @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();
|
|
|
- }, $this->createFixerFactory()->getFixers());
|
|
|
+ }, $fixers);
|
|
|
|
|
|
$unknownFixers = array_diff(
|
|
|
$configuredFixers,
|
|
@@ -774,6 +756,24 @@ final class ConfigurationResolver
|
|
|
|
|
|
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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -917,14 +917,13 @@ final class ConfigurationResolver
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ $message = sprintf('Expected "yes" or "no" for option "%s", other values are deprecated and support will be removed in 3.0. Got "%s", this implicitly set the option to "false".', $optionName, $value);
|
|
|
+
|
|
|
if (getenv('PHP_CS_FIXER_FUTURE_MODE')) {
|
|
|
- throw new InvalidConfigurationException(sprintf('Expected "yes" or "no" for option "%s", got "%s". This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.', $optionName, $value));
|
|
|
+ throw new InvalidConfigurationException("{$message} This check was performed as `PHP_CS_FIXER_FUTURE_MODE` env var is set.");
|
|
|
}
|
|
|
|
|
|
- @trigger_error(
|
|
|
- sprintf('Expected "yes" or "no" for option "%s", other values are deprecated and support will be removed in 3.0. Got "%s", this implicitly set the option to "false".', $optionName, $value),
|
|
|
- E_USER_DEPRECATED
|
|
|
- );
|
|
|
+ @trigger_error($message, E_USER_DEPRECATED);
|
|
|
|
|
|
return false;
|
|
|
}
|