• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keradus / PHP-CS-Fixer / 17252691116

26 Aug 2025 11:09PM UTC coverage: 94.743% (-0.01%) from 94.755%
17252691116

push

github

keradus
chore: apply phpdoc_tag_no_named_arguments

28313 of 29884 relevant lines covered (94.74%)

45.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <fabien@symfony.com>
9
 *     Dariusz RumiƄski <dariusz.ruminski@gmail.com>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14

15
namespace PhpCsFixer\Fixer\Phpdoc;
16

17
use PhpCsFixer\AbstractProxyFixer;
18
use PhpCsFixer\ConfigurationException\InvalidConfigurationException;
19
use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException;
20
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
21
use PhpCsFixer\Fixer\ConfigurableFixerTrait;
22
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
23
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
24
use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
25
use PhpCsFixer\FixerDefinition\CodeSample;
26
use PhpCsFixer\FixerDefinition\FixerDefinition;
27
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
28
use PhpCsFixer\Preg;
29

30
/**
31
 * @phpstan-type _AutogeneratedInputConfiguration array{
32
 *  tags?: list<string>,
33
 * }
34
 * @phpstan-type _AutogeneratedComputedConfiguration array{
35
 *  tags: list<string>,
36
 * }
37
 *
38
 * @implements ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>
39
 *
40
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
41
 */
42
final class PhpdocTagCasingFixer extends AbstractProxyFixer implements ConfigurableFixerInterface
43
{
44
    /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */
45
    use ConfigurableFixerTrait;
46

47
    public function getDefinition(): FixerDefinitionInterface
48
    {
49
        return new FixerDefinition(
3✔
50
            'Fixes casing of PHPDoc tags.',
3✔
51
            [
3✔
52
                new CodeSample("<?php\n/**\n * @inheritdoc\n */\n"),
3✔
53
                new CodeSample("<?php\n/**\n * @inheritdoc\n * @Foo\n */\n", [
3✔
54
                    'tags' => ['foo'],
3✔
55
                ]),
3✔
56
            ]
3✔
57
        );
3✔
58
    }
59

60
    /**
61
     * {@inheritdoc}
62
     *
63
     * Must run before PhpdocAlignFixer.
64
     * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
65
     */
66
    public function getPriority(): int
67
    {
68
        return parent::getPriority();
1✔
69
    }
70

71
    protected function configurePostNormalisation(): void
72
    {
73
        $replacements = [];
16✔
74
        foreach ($this->configuration['tags'] as $tag) {
16✔
75
            $replacements[$tag] = $tag;
16✔
76
        }
77

78
        /** @var GeneralPhpdocTagRenameFixer $generalPhpdocTagRenameFixer */
79
        $generalPhpdocTagRenameFixer = $this->proxyFixers['general_phpdoc_tag_rename'];
16✔
80

81
        try {
82
            $generalPhpdocTagRenameFixer->configure([
16✔
83
                'case_sensitive' => false,
16✔
84
                'fix_annotation' => true,
16✔
85
                'fix_inline' => true,
16✔
86
                'replacements' => $replacements,
16✔
87
            ]);
16✔
88
        } catch (InvalidConfigurationException $exception) {
×
89
            throw new InvalidFixerConfigurationException(
×
90
                $this->getName(),
×
91
                Preg::replace('/^\[.+?\] /', '', $exception->getMessage()),
×
92
                $exception
×
93
            );
×
94
        }
95
    }
96

97
    protected function createConfigurationDefinition(): FixerConfigurationResolverInterface
98
    {
99
        return new FixerConfigurationResolver([
16✔
100
            (new FixerOptionBuilder('tags', 'List of tags to fix with their expected casing.'))
16✔
101
                ->setAllowedTypes(['string[]'])
16✔
102
                ->setDefault(['inheritDoc'])
16✔
103
                ->getOption(),
16✔
104
        ]);
16✔
105
    }
106

107
    protected function createProxyFixers(): array
108
    {
109
        return [new GeneralPhpdocTagRenameFixer()];
16✔
110
    }
111
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc