Skip to content

Commit d860473

Browse files
authored
Add PhpdocTagNoNamedArgumentsFixer (#1032)
1 parent 86ffd73 commit d860473

File tree

66 files changed

+625
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+625
-2
lines changed

.php-cs-fixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PhpCsFixerConfig\Rules\LibraryRules;
2020
use PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer;
2121
use PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer;
22+
use PhpCsFixerCustomFixers\Fixer\PhpdocTagNoNamedArgumentsFixer;
2223
use PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer;
2324
use PhpCsFixerCustomFixers\Fixer\TypedClassConstantFixer;
2425
use PhpCsFixerCustomFixers\Fixers;
@@ -57,6 +58,7 @@
5758
unset($rules[PromotedConstructorPropertyFixer::name()]); // TODO: remove when dropping support to PHP <8.0
5859
unset($rules[TypedClassConstantFixer::name()]); // TODO: remove when dropping support to PHP <8.3
5960
$rules['trailing_comma_in_multiline'] = ['after_heredoc' => true, 'elements' => ['arguments', 'arrays']]; // TODO: remove when dropping support to PHP <8.0
61+
$rules[PhpdocTagNoNamedArgumentsFixer::name()] = ['directory' => __DIR__ . '/src/'];
6062

6163
$rules[PhpdocOnlyAllowedAnnotationsFixer::name()]['elements'][] = 'phpstan-type';
6264

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG for PHP CS Fixer: custom fixers
22

3+
## v3.27.0
4+
- Add PhpdocTagNoNamedArgumentsFixer
5+
36
## v3.26.0
47
- Add TypedClassConstantFixer
58

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
66
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
77
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
8-
![Tests](https://img.shields.io/badge/tests-3750-brightgreen.svg)
8+
![Tests](https://img.shields.io/badge/tests-3788-brightgreen.svg)
99
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
1010

1111
[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml)
@@ -610,6 +610,23 @@ The `@var` annotation must be on a single line if it is the only content.
610610
}
611611
```
612612

613+
#### PhpdocTagNoNamedArgumentsFixer
614+
There must be `@no-named-arguments` tag in PHPDoc of a class/enum/interface/trait.
615+
Configuration options:
616+
- `description` (`string`): description of the tag; defaults to `''`
617+
- `directory` (`string`): directory in which apply the changes, empty value will result with current working directory (result of `getcwd` call); defaults to `''`
618+
```diff
619+
<?php
620+
+
621+
+/**
622+
+ * @no-named-arguments
623+
+ */
624+
class Foo
625+
{
626+
public function bar(string $s) {}
627+
}
628+
```
629+
613630
#### PhpdocTypeListFixer
614631
PHPDoc type `list` must be used instead of `array` without a key type.
615632
DEPRECATED: use `phpdoc_list_type` instead.

src/Fixer/AbstractFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use PhpCsFixer\Fixer\FixerInterface;
1515
use PhpCsFixer\Preg;
1616

17+
/**
18+
* @no-named-arguments
19+
*/
1720
abstract class AbstractFixer implements FixerInterface
1821
{
1922
final public static function name(): string

src/Fixer/AbstractTypesFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use PhpCsFixer\Tokenizer\Token;
1616
use PhpCsFixer\Tokenizer\Tokens;
1717

18+
/**
19+
* @no-named-arguments
20+
*/
1821
abstract class AbstractTypesFixer extends AbstractFixer
1922
{
2023
final public function isCandidate(Tokens $tokens): bool

src/Fixer/ClassConstantUsageFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use PhpCsFixer\Tokenizer\Token;
1818
use PhpCsFixer\Tokenizer\Tokens;
1919

20+
/**
21+
* @no-named-arguments
22+
*/
2023
final class ClassConstantUsageFixer extends AbstractFixer
2124
{
2225
public function getDefinition(): FixerDefinitionInterface

src/Fixer/CommentSurroundedBySpacesFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use PhpCsFixer\Tokenizer\Token;
1919
use PhpCsFixer\Tokenizer\Tokens;
2020

21+
/**
22+
* @no-named-arguments
23+
*/
2124
final class CommentSurroundedBySpacesFixer extends AbstractFixer
2225
{
2326
public function getDefinition(): FixerDefinitionInterface

src/Fixer/CommentedOutFunctionFixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*
3030
* @phpstan-type _InputConfig array{functions?: list<string>}
3131
* @phpstan-type _Config array{functions: list<string>}
32+
*
33+
* @no-named-arguments
3234
*/
3335
final class CommentedOutFunctionFixer extends AbstractFixer implements ConfigurableFixerInterface
3436
{

src/Fixer/ConstructorEmptyBracesFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use PhpCsFixer\Tokenizer\Tokens;
1818
use PhpCsFixerCustomFixers\Analyzer\ConstructorAnalyzer;
1919

20+
/**
21+
* @no-named-arguments
22+
*/
2023
final class ConstructorEmptyBracesFixer extends AbstractFixer
2124
{
2225
public function getDefinition(): FixerDefinitionInterface

src/Fixer/DataProviderNameFixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*
3030
* @phpstan-type _InputConfig array{prefix?: string, suffix?: string}
3131
* @phpstan-type _Config array{prefix: string, suffix: string}
32+
*
33+
* @no-named-arguments
3234
*/
3335
final class DataProviderNameFixer extends AbstractFixer implements ConfigurableFixerInterface, DeprecatedFixerInterface
3436
{

0 commit comments

Comments
 (0)