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

PHP-CS-Fixer / PHP-CS-Fixer / 22808552760

07 Mar 2026 10:26PM UTC coverage: 92.913% (-0.01%) from 92.925%
22808552760

push

github

web-flow
chore: commands cleanup (#9478)

14 of 23 new or added lines in 12 files covered. (60.87%)

1 existing line in 1 file now uncovered.

29395 of 31637 relevant lines covered (92.91%)

43.93 hits per line

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

0.0
/src/Console/Internal/Command/DecodeIdCommand.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\Console\Internal\Command;
16

17
use PhpCsFixer\Tokenizer\Token;
18
use Symfony\Component\Console\Attribute\AsCommand;
19
use Symfony\Component\Console\Command\Command;
20
use Symfony\Component\Console\Input\InputArgument;
21
use Symfony\Component\Console\Input\InputInterface;
22
use Symfony\Component\Console\Output\ConsoleOutputInterface;
23
use Symfony\Component\Console\Output\OutputInterface;
24

25
/**
26
 * @internal
27
 *
28
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
29
 */
30
#[AsCommand(name: 'decode-id', description: 'Get symbolic name of token id.')]
31
final class DecodeIdCommand extends Command
32
{
33
    public function __construct()
34
    {
NEW
35
        parent::__construct('decode-id');
×
NEW
36
        $this->setDescription('Get symbolic name of token id.');
×
37
    }
38

39
    protected function configure(): void
40
    {
41
        $this
×
42
            ->setDefinition(
×
43
                [
×
44
                    new InputArgument('id', InputArgument::REQUIRED),
×
45
                ],
×
46
            )
×
47
        ;
×
48
    }
49

50
    protected function execute(InputInterface $input, OutputInterface $output): int
51
    {
52
        $stdErr = $output instanceof ConsoleOutputInterface
×
53
            ? $output->getErrorOutput()
×
54
            : $output;
×
55

56
        $id = $input->getArgument('id');
×
57

58
        if (false === filter_var($id, \FILTER_VALIDATE_INT)) {
×
59
            $stdErr->writeln('<error>Non-numeric "id" value.</error>');
×
60

61
            return 1;
×
62
        }
63

64
        $id = \intval($id, 10);
×
65

66
        $name = Token::getNameForId($id);
×
67
        if (null === $name) {
×
68
            $stdErr->writeln('<error>Unknown "id".</error>');
×
69

70
            return 1;
×
71
        }
72

73
        $output->writeln($name);
×
74

75
        return 0;
×
76
    }
77
}
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