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

eliashaeussler / php-cs-fixer-config / 16303565736

15 Jul 2025 08:25PM UTC coverage: 100.0%. Remained the same
16303565736

push

github

web-flow
[TASK] Update friendsofphp/php-cs-fixer to v3.84.0

| datasource | package                   | from   | to     |
| ---------- | ------------------------- | ------ | ------ |
| packagist  | friendsofphp/php-cs-fixer | 3.83.0 | 3.84.0 |

137 of 137 relevant lines covered (100.0%)

4.75 hits per line

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

100.0
/src/Config.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/php-cs-fixer-config".
7
 *
8
 * Copyright (C) 2023-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\PhpCsFixerConfig;
25

26
use PhpCsFixer\ConfigInterface;
27
use PhpCsFixer\Runner;
28
use Symfony\Component\Finder;
29

30
use function array_replace_recursive;
31
use function class_exists;
32

33
/**
34
 * Config.
35
 *
36
 * @author Elias Häußler <elias@haeussler.dev>
37
 * @license GPL-3.0-or-later
38
 *
39
 * @phpstan-import-type TRulesArray from Rules\Rule
40
 */
41
final class Config extends \PhpCsFixer\Config
42
{
43
    public static function create(): self
7✔
44
    {
45
        $config = new self();
7✔
46
        $config->withRule(Rules\Set\DefaultRuleSet::create(), false);
7✔
47
        $config->setRiskyAllowed(true);
7✔
48
        $config->getFinder()->ignoreDotFiles(false);
7✔
49
        $config->getFinder()->ignoreVCSIgnored(true);
7✔
50

51
        // Enable parallel execution (PHP-CS-Fixer >= 3.57)
52
        if (class_exists(Runner\Parallel\ParallelConfig::class)) {
7✔
53
            $config->setParallelConfig(Runner\Parallel\ParallelConfigFactory::detect());
7✔
54
        }
55

56
        return $config;
7✔
57
    }
58

59
    public function withRule(Rules\Rule $rule, bool $merge = true): self
7✔
60
    {
61
        if ($merge) {
7✔
62
            /** @var TRulesArray $rules */
63
            $rules = array_replace_recursive($this->getRules(), $rule->get());
2✔
64
        } else {
65
            $rules = $rule->get();
7✔
66
        }
67

68
        $this->setRules($rules);
7✔
69

70
        return $this;
7✔
71
    }
72

73
    /**
74
     * @param Finder\Finder|callable(Finder\Finder): Finder\Finder $finder
75
     */
76
    public function withFinder(Finder\Finder|callable $finder): self
2✔
77
    {
78
        if (!($finder instanceof Finder\Finder)) {
2✔
79
            $finder = $finder($this->getFinder());
1✔
80
        }
81

82
        $this->setFinder($finder);
2✔
83

84
        return $this;
2✔
85
    }
86

87
    public function withConfig(ConfigInterface $config): self
1✔
88
    {
89
        $this->setRules($config->getRules());
1✔
90
        $this->setRiskyAllowed($config->getRiskyAllowed());
1✔
91
        $this->setFinder($config->getFinder());
1✔
92

93
        return $this;
1✔
94
    }
95
}
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