• 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

61.54
/src/Fixer/ArrayNotation/NormalizeIndexBraceFixer.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\ArrayNotation;
16

17
use PhpCsFixer\AbstractFixer;
18
use PhpCsFixer\FixerDefinition\FixerDefinition;
19
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
20
use PhpCsFixer\FixerDefinition\VersionSpecification;
21
use PhpCsFixer\FixerDefinition\VersionSpecificCodeSample;
22
use PhpCsFixer\Tokenizer\CT;
23
use PhpCsFixer\Tokenizer\Token;
24
use PhpCsFixer\Tokenizer\Tokens;
25

26
/**
27
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
28
 *
29
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
30
 */
31
final class NormalizeIndexBraceFixer extends AbstractFixer
32
{
33
    public function getDefinition(): FixerDefinitionInterface
34
    {
35
        return new FixerDefinition(
3✔
36
            'Array index should always be written by using square braces.',
3✔
37
            [new VersionSpecificCodeSample(
3✔
38
                "<?php\necho \$sample{\$index};\n",
3✔
39
                new VersionSpecification(null, 8_04_00 - 1)
3✔
40
            )]
3✔
41
        );
3✔
42
    }
43

44
    public function isCandidate(Tokens $tokens): bool
45
    {
46
        return $tokens->isTokenKindFound(CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN);
1✔
47
    }
48

49
    protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
50
    {
51
        foreach ($tokens as $index => $token) {
×
52
            if ($token->isGivenKind(CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN)) {
×
53
                $tokens[$index] = new Token('[');
×
54
            } elseif ($token->isGivenKind(CT::T_ARRAY_INDEX_CURLY_BRACE_CLOSE)) {
×
55
                $tokens[$index] = new Token(']');
×
56
            }
57
        }
58
    }
59
}
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