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

keradus / PHP-CS-Fixer / 16715846151

04 Aug 2025 06:35AM UTC coverage: 94.716% (-0.01%) from 94.728%
16715846151

push

github

web-flow
Merge branch 'master' into checkstyle

55 of 69 new or added lines in 18 files covered. (79.71%)

3 existing lines in 1 file now uncovered.

28230 of 29805 relevant lines covered (94.72%)

45.9 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
final class WarningsDetector
26
{
27
    private ToolInfoInterface $toolInfo;
28

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

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

39
    public function detectOldMajor(): void
40
    {
41
        // @TODO 3.99 to be activated with new MAJOR release 4.0
42
        // $currentMajorVersion = \intval(explode('.', Application::VERSION)[0], 10);
43
        // $nextMajorVersion = $currentMajorVersion + 1;
44
        // $this->warnings[] = "You are running PHP CS Fixer v{$currentMajorVersion}, which is not maintained anymore. Please update to v{$nextMajorVersion}.";
45
        // $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 .";
46
    }
×
47

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

62
    public function detectNonMonolithic(): void
63
    {
NEW
64
        if (filter_var(getenv('PHP_CS_FIXER_NON_MONOLITHIC'), \FILTER_VALIDATE_BOOL)) {
×
NEW
65
            $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.';
×
66
        }
67
    }
68

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

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