Skip to content

Commit 76e39d3

Browse files
authored
Improve fixer name in README.md (#1092)
1 parent 230dd01 commit 76e39d3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.dev-tools/src/Readme/ReadmeCommand.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313

1414
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
1515
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
16+
use PhpCsFixer\Fixer\FixerInterface;
1617
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
1718
use PhpCsFixer\FixerDefinition\CodeSampleInterface;
19+
use PhpCsFixer\FixerFactory;
20+
use PhpCsFixer\RuleSet\RuleSet;
1821
use PhpCsFixer\Tokenizer\Tokens;
1922
use PhpCsFixer\Utils;
2023
use PhpCsFixer\WhitespacesFixerConfig;
@@ -168,7 +171,22 @@ private static function fixers(): string
168171
$fixer->getDefinition()->getSummary(),
169172
);
170173

171-
$output .= $fixer instanceof DeprecatedFixerInterface ? \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $fixer->getSuccessorsNames())) : '';
174+
if ($fixer instanceof DeprecatedFixerInterface) {
175+
$fixers = (new FixerFactory())
176+
->registerBuiltInFixers()
177+
->registerCustomFixers(new Fixers())
178+
->useRuleSet(new RuleSet(\array_combine($fixer->getSuccessorsNames(), [true])))
179+
->getFixers();
180+
181+
$successors = \array_map(
182+
static fn (FixerInterface $fixer): string => $fixer instanceof AbstractFixer
183+
? (new \ReflectionObject($fixer))->getShortName()
184+
: $fixer->getName(),
185+
$fixers,
186+
);
187+
188+
$output .= \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $successors));
189+
}
172190

173191
if ($fixer instanceof DataProviderStaticFixer) {
174192
$fixer->configure(['force' => true]);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ Configuration options:
463463

464464
#### PhpDocPropertySorterFixer
465465
Sorts @property annotations in PHPDoc blocks alphabetically within groups separated by empty lines.
466-
DEPRECATED: use `PhpCsFixerCustomFixers/phpdoc_property_sorted` instead.
466+
DEPRECATED: use `PhpdocPropertySortedFixer` instead.
467467
```diff
468468
<?php
469469
/**

0 commit comments

Comments
 (0)