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

keradus / PHP-CS-Fixer / 16715837382

04 Aug 2025 06:34AM UTC coverage: 94.728% (+0.01%) from 94.716%
16715837382

push

github

keradus
chore: switch to official checkstyle.xsd

28212 of 29782 relevant lines covered (94.73%)

45.91 hits per line

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

76.47
/src/Console/Command/HelpCommand.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\Command;
16

17
use PhpCsFixer\FixerConfiguration\AllowedValueSubset;
18
use PhpCsFixer\FixerConfiguration\FixerOptionInterface;
19
use PhpCsFixer\Utils;
20
use Symfony\Component\Console\Attribute\AsCommand;
21
use Symfony\Component\Console\Command\HelpCommand as BaseHelpCommand;
22
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
23
use Symfony\Component\Console\Input\InputInterface;
24
use Symfony\Component\Console\Output\OutputInterface;
25

26
/**
27
 * @author Fabien Potencier <fabien@symfony.com>
28
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
29
 *
30
 * @internal
31
 */
32
#[AsCommand(name: 'help')]
33
final class HelpCommand extends BaseHelpCommand
34
{
35
    /** @TODO PHP 8.0 - remove the property */
36
    protected static $defaultName = 'help';
37

38
    /**
39
     * Returns the allowed values of the given option that can be converted to a string.
40
     *
41
     * @return null|list<AllowedValueSubset|mixed>
42
     */
43
    public static function getDisplayableAllowedValues(FixerOptionInterface $option): ?array
44
    {
45
        $allowed = $option->getAllowedValues();
4✔
46

47
        if (null !== $allowed) {
4✔
48
            $allowed = array_filter($allowed, static fn ($value): bool => !$value instanceof \Closure);
2✔
49

50
            usort($allowed, static function ($valueA, $valueB): int {
2✔
51
                if ($valueA instanceof AllowedValueSubset) {
2✔
52
                    return -1;
×
53
                }
54

55
                if ($valueB instanceof AllowedValueSubset) {
2✔
56
                    return 1;
×
57
                }
58

59
                return strcasecmp(
2✔
60
                    Utils::toString($valueA),
2✔
61
                    Utils::toString($valueB)
2✔
62
                );
2✔
63
            });
2✔
64

65
            if (0 === \count($allowed)) {
2✔
66
                $allowed = null;
×
67
            }
68
        }
69

70
        return $allowed;
4✔
71
    }
72

73
    protected function initialize(InputInterface $input, OutputInterface $output): void
74
    {
75
        $output->getFormatter()->setStyle('url', new OutputFormatterStyle('blue'));
×
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