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

keradus / PHP-CS-Fixer / 22042339290

15 Feb 2026 08:14PM UTC coverage: 92.957% (-0.2%) from 93.171%
22042339290

push

github

keradus
test: check PHP env in CI jobs

29302 of 31522 relevant lines covered (92.96%)

44.04 hits per line

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

85.71
/src/Error/ErrorsManager.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\Error;
16

17
/**
18
 * Manager of errors that occur during fixing.
19
 *
20
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
21
 *
22
 * @internal
23
 *
24
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
25
 */
26
final class ErrorsManager
27
{
28
    /**
29
     * @var list<Error>
30
     */
31
    private array $errors = [];
32

33
    /**
34
     * Returns errors reported during linting before fixing.
35
     *
36
     * @return list<Error>
37
     */
38
    public function getInvalidErrors(): array
39
    {
40
        return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_INVALID === $error->getType()));
4✔
41
    }
42

43
    /**
44
     * Returns errors reported during fixing.
45
     *
46
     * @return list<Error>
47
     */
48
    public function getExceptionErrors(): array
49
    {
50
        return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_EXCEPTION === $error->getType()));
4✔
51
    }
52

53
    /**
54
     * Returns errors reported during linting after fixing.
55
     *
56
     * @return list<Error>
57
     */
58
    public function getLintErrors(): array
59
    {
60
        return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_LINT === $error->getType()));
4✔
61
    }
62

63
    /**
64
     * @return list<Error>
65
     */
66
    public function getAllErrors(): array
67
    {
68
        return $this->errors;
×
69
    }
70

71
    /**
72
     * Returns errors reported for specified path.
73
     *
74
     * @return list<Error>
75
     */
76
    public function forPath(string $path): array
77
    {
78
        return array_values(array_filter($this->errors, static fn (Error $error): bool => $path === $error->getFilePath()));
1✔
79
    }
80

81
    /**
82
     * Returns true if no errors were reported.
83
     */
84
    public function isEmpty(): bool
85
    {
86
        return [] === $this->errors;
5✔
87
    }
88

89
    public function report(Error $error): void
90
    {
91
        $this->errors[] = $error;
4✔
92
    }
93
}
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