• 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

83.33
/src/Console/WarningsDetector.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;
16

17
use PhpCsFixer\ToolInfo;
18
use PhpCsFixer\ToolInfoInterface;
19

20
/**
21
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
22
 *
23
 * @internal
24
 *
25
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
26
 */
27
final class WarningsDetector
28
{
29
    private ToolInfoInterface $toolInfo;
30

31
    /**
32
     * @var list<string>
33
     */
34
    private array $warnings = [];
35

36
    public function __construct(ToolInfoInterface $toolInfo)
37
    {
38
        $this->toolInfo = $toolInfo;
3✔
39
    }
40

41
    public function detectOldMajor(): void
42
    {
43
        // @TODO 3.99 to be activated with new MAJOR release 4.0
44
        // $currentMajorVersion = \intval(explode('.', Application::VERSION)[0], 10);
45
        // $nextMajorVersion = $currentMajorVersion + 1;
46
        // $this->warnings[] = "You are running PHP CS Fixer v{$currentMajorVersion}, which is not maintained anymore. Please update to v{$nextMajorVersion}.";
47
        // $this->warnings[] = "You may find an UPGRADE guide at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v{$nextMajorVersion}.0.0/UPGRADE-v{$nextMajorVersion}.md .";
48
    }
×
49

50
    public function detectOldVendor(): void
51
    {
52
        if ($this->toolInfo->isInstalledByComposer()) {
3✔
53
            $details = $this->toolInfo->getComposerInstallationDetails();
1✔
54
            if (ToolInfo::COMPOSER_LEGACY_PACKAGE_NAME === $details['name']) {
1✔
55
                $this->warnings[] = \sprintf(
1✔
56
                    'You are running PHP CS Fixer installed with old vendor `%s`. Please update to `%s`.',
1✔
57
                    ToolInfo::COMPOSER_LEGACY_PACKAGE_NAME,
1✔
58
                    ToolInfo::COMPOSER_PACKAGE_NAME
1✔
59
                );
1✔
60
            }
61
        }
62
    }
63

64
    public function detectNonMonolithic(): void
65
    {
66
        if (filter_var(getenv('PHP_CS_FIXER_NON_MONOLITHIC'), \FILTER_VALIDATE_BOOL)) {
×
67
            $this->warnings[] = 'Processing non-monolithic files enabled, because `PHP_CS_FIXER_NON_MONOLITHIC` is set. Execution result may be unpredictable - non-monolithic files are not officially supported.';
×
68
        }
69
    }
70

71
    /**
72
     * @return list<string>
73
     */
74
    public function getWarnings(): array
75
    {
76
        if (0 === \count($this->warnings)) {
3✔
77
            return [];
2✔
78
        }
79

80
        return array_values(array_unique(array_merge(
1✔
81
            $this->warnings,
1✔
82
            ['If you need help while solving warnings, ask at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/discussions/, we will help you!']
1✔
83
        )));
1✔
84
    }
85
}
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