diff --git a/CHANGELOG.md b/CHANGELOG.md index 3571bad0..37af0f9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## v3.34.0 - Add PhpDocPropertySorterFixer +- Deprecate PhpdocTagNoNamedArgumentsFixer - use "phpdoc_tag_no_named_arguments" +- Update minimum PHP CS Fixer version to 3.87.0 ## v3.33.0 - Update minimum PHP CS Fixer version to 3.86.0 diff --git a/README.md b/README.md index 4c984222..926a29d7 100644 --- a/README.md +++ b/README.md @@ -643,6 +643,7 @@ The `@var` annotation must be on a single line if it is the only content. #### PhpdocTagNoNamedArgumentsFixer There must be `@no-named-arguments` tag in PHPDoc of a class/enum/interface/trait. + DEPRECATED: use `phpdoc_tag_no_named_arguments` instead. Configuration options: - `description` (`string`): description of the tag; defaults to `''` - `directory` (`string`): directory in which apply the changes, empty value will result with current working directory (result of `getcwd` call); defaults to `''` diff --git a/composer.json b/composer.json index eb422d93..c9ea53cb 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": "^7.4 || ^8.0", "ext-filter": "*", "ext-tokenizer": "*", - "friendsofphp/php-cs-fixer": "^3.86" + "friendsofphp/php-cs-fixer": "^3.87" }, "require-dev": { "phpunit/phpunit": "^9.6.24 || ^10.5.51 || ^11.5.32" diff --git a/src/Fixer/PhpdocTagNoNamedArgumentsFixer.php b/src/Fixer/PhpdocTagNoNamedArgumentsFixer.php index 085ffe1e..6675f9d3 100644 --- a/src/Fixer/PhpdocTagNoNamedArgumentsFixer.php +++ b/src/Fixer/PhpdocTagNoNamedArgumentsFixer.php @@ -13,6 +13,8 @@ use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException; use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; +use PhpCsFixer\Fixer\Phpdoc\PhpdocTagNoNamedArgumentsFixer as PTNNAFixer; use PhpCsFixer\Fixer\PhpUnit\PhpUnitInternalClassFixer; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; @@ -32,6 +34,8 @@ use PhpCsFixer\WhitespacesFixerConfig; /** + * @deprecated + * * @implements ConfigurableFixerInterface<_InputConfig, _Config> * * @phpstan-type _InputConfig array{directory?: string, description?: string} @@ -39,12 +43,20 @@ * * @no-named-arguments */ -final class PhpdocTagNoNamedArgumentsFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface +final class PhpdocTagNoNamedArgumentsFixer extends AbstractFixer implements ConfigurableFixerInterface, DeprecatedFixerInterface, WhitespacesAwareFixerInterface { private string $description = ''; private string $directory = ''; private WhitespacesFixerConfig $whitespacesConfig; + /** + * @return list + */ + public function getSuccessorsNames(): array + { + return [(new PTNNAFixer())->getName()]; + } + public function setWhitespacesConfig(WhitespacesFixerConfig $config): void { $this->whitespacesConfig = $config; diff --git a/tests/Fixer/PhpdocTagNoNamedArgumentsFixerTest.php b/tests/Fixer/PhpdocTagNoNamedArgumentsFixerTest.php index f3f8cf04..28327da8 100644 --- a/tests/Fixer/PhpdocTagNoNamedArgumentsFixerTest.php +++ b/tests/Fixer/PhpdocTagNoNamedArgumentsFixerTest.php @@ -48,6 +48,11 @@ public function testIsRisky(): void self::assertRiskiness(false); } + public function testSuccessorName(): void + { + self::assertSuccessorName('phpdoc_tag_no_named_arguments'); + } + /** * @param array $configuration *