diff --git a/.dev-tools/src/Readme/ReadmeCommand.php b/.dev-tools/src/Readme/ReadmeCommand.php index 2f89ebea..3831ce18 100644 --- a/.dev-tools/src/Readme/ReadmeCommand.php +++ b/.dev-tools/src/Readme/ReadmeCommand.php @@ -13,8 +13,11 @@ use PhpCsFixer\Fixer\ConfigurableFixerInterface; use PhpCsFixer\Fixer\DeprecatedFixerInterface; +use PhpCsFixer\Fixer\FixerInterface; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; use PhpCsFixer\FixerDefinition\CodeSampleInterface; +use PhpCsFixer\FixerFactory; +use PhpCsFixer\RuleSet\RuleSet; use PhpCsFixer\Tokenizer\Tokens; use PhpCsFixer\Utils; use PhpCsFixer\WhitespacesFixerConfig; @@ -168,7 +171,22 @@ private static function fixers(): string $fixer->getDefinition()->getSummary(), ); - $output .= $fixer instanceof DeprecatedFixerInterface ? \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $fixer->getSuccessorsNames())) : ''; + if ($fixer instanceof DeprecatedFixerInterface) { + $fixers = (new FixerFactory()) + ->registerBuiltInFixers() + ->registerCustomFixers(new Fixers()) + ->useRuleSet(new RuleSet(\array_combine($fixer->getSuccessorsNames(), [true]))) + ->getFixers(); + + $successors = \array_map( + static fn (FixerInterface $fixer): string => $fixer instanceof AbstractFixer + ? (new \ReflectionObject($fixer))->getShortName() + : $fixer->getName(), + $fixers, + ); + + $output .= \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $successors)); + } if ($fixer instanceof DataProviderStaticFixer) { $fixer->configure(['force' => true]); diff --git a/README.md b/README.md index 6f7bc2a2..da8459d6 100644 --- a/README.md +++ b/README.md @@ -463,7 +463,7 @@ Configuration options: #### PhpDocPropertySorterFixer Sorts @property annotations in PHPDoc blocks alphabetically within groups separated by empty lines. - DEPRECATED: use `PhpCsFixerCustomFixers/phpdoc_property_sorted` instead. + DEPRECATED: use `PhpdocPropertySortedFixer` instead. ```diff