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

keradus / PHP-CS-Fixer / 19958239208

05 Dec 2025 09:13AM UTC coverage: 93.181% (-1.0%) from 94.158%
19958239208

push

github

keradus
chore: .php-cs-fixer.dist.php - remove no longer needed rule, 'expectedDeprecation' annotation does not exist for long time

28928 of 31045 relevant lines covered (93.18%)

44.49 hits per line

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

92.73
/src/Config.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;
16

17
use PhpCsFixer\Fixer\FixerInterface;
18
use PhpCsFixer\RuleSet\RuleSetDefinitionInterface;
19
use PhpCsFixer\Runner\Parallel\ParallelConfig;
20
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
21

22
/**
23
 * @author Fabien Potencier <fabien@symfony.com>
24
 * @author Katsuhiro Ogawa <ko.fivestar@gmail.com>
25
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
26
 *
27
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
28
 */
29
class Config implements ConfigInterface, ParallelAwareConfigInterface, UnsupportedPhpVersionAllowedConfigInterface, CustomRulesetsAwareConfigInterface
30
{
31
    /**
32
     * @var non-empty-string
33
     */
34
    private string $cacheFile = '.php-cs-fixer.cache';
35

36
    /**
37
     * @var list<FixerInterface>
38
     */
39
    private array $customFixers = [];
40

41
    /**
42
     * @var array<string, RuleSetDefinitionInterface>
43
     */
44
    private array $customRuleSets = [];
45

46
    /**
47
     * @var null|iterable<\SplFileInfo>
48
     */
49
    private ?iterable $finder = null;
50

51
    private string $format;
52

53
    private bool $hideProgress = false;
54

55
    /**
56
     * @var non-empty-string
57
     */
58
    private string $indent = '    ';
59

60
    private bool $isRiskyAllowed = false;
61

62
    /**
63
     * @var non-empty-string
64
     */
65
    private string $lineEnding = "\n";
66

67
    private string $name;
68

69
    private ParallelConfig $parallelConfig;
70

71
    private ?string $phpExecutable = null;
72

73
    /**
74
     * @TODO: 4.0 - update to @PER
75
     *
76
     * @var array<string, array<string, mixed>|bool>
77
     */
78
    private array $rules;
79

80
    private bool $usingCache = true;
81

82
    private bool $isUnsupportedPhpVersionAllowed = false;
83

84
    public function __construct(string $name = 'default')
85
    {
86
        $this->name = $name.(Future::isFutureModeEnabled() ? ' (future mode)' : '');
18✔
87
        $this->rules = Future::getV4OrV3(['@PER-CS' => true], ['@PSR12' => true]); // @TODO 4.0 | 3.x switch to '@auto' for v4
18✔
88
        $this->format = Future::getV4OrV3('@auto', 'txt');
18✔
89

90
        // @TODO 4.0 cleanup
91
        if (Future::isFutureModeEnabled() || filter_var(getenv('PHP_CS_FIXER_PARALLEL'), \FILTER_VALIDATE_BOOL)) {
18✔
92
            $this->parallelConfig = ParallelConfigFactory::detect();
1✔
93
        } else {
94
            $this->parallelConfig = ParallelConfigFactory::sequential();
17✔
95
        }
96

97
        // @TODO 4.0 cleanup
98
        if (false !== getenv('PHP_CS_FIXER_IGNORE_ENV')) {
18✔
99
            $this->isUnsupportedPhpVersionAllowed = filter_var(getenv('PHP_CS_FIXER_IGNORE_ENV'), \FILTER_VALIDATE_BOOL);
18✔
100
        }
101
    }
102

103
    /**
104
     * @return non-empty-string
105
     */
106
    public function getCacheFile(): string
107
    {
108
        return $this->cacheFile;
3✔
109
    }
110

111
    public function getCustomFixers(): array
112
    {
113
        return $this->customFixers;
5✔
114
    }
115

116
    public function getCustomRuleSets(): array
117
    {
118
        return array_values($this->customRuleSets);
3✔
119
    }
120

121
    /**
122
     * @return Finder
123
     */
124
    public function getFinder(): iterable
125
    {
126
        $this->finder ??= new Finder();
4✔
127

128
        return $this->finder;
4✔
129
    }
130

131
    public function getFormat(): string
132
    {
133
        return $this->format;
1✔
134
    }
135

136
    public function getHideProgress(): bool
137
    {
138
        return $this->hideProgress;
1✔
139
    }
140

141
    public function getIndent(): string
142
    {
143
        return $this->indent;
1✔
144
    }
145

146
    public function getLineEnding(): string
147
    {
148
        return $this->lineEnding;
1✔
149
    }
150

151
    public function getName(): string
152
    {
153
        return $this->name;
3✔
154
    }
155

156
    public function getParallelConfig(): ParallelConfig
157
    {
158
        return $this->parallelConfig;
2✔
159
    }
160

161
    public function getPhpExecutable(): ?string
162
    {
163
        return $this->phpExecutable;
1✔
164
    }
165

166
    public function getRiskyAllowed(): bool
167
    {
168
        return $this->isRiskyAllowed;
1✔
169
    }
170

171
    public function getRules(): array
172
    {
173
        return $this->rules;
2✔
174
    }
175

176
    public function getUsingCache(): bool
177
    {
178
        return $this->usingCache;
1✔
179
    }
180

181
    public function getUnsupportedPhpVersionAllowed(): bool
182
    {
183
        return $this->isUnsupportedPhpVersionAllowed;
1✔
184
    }
185

186
    public function registerCustomFixers(iterable $fixers): ConfigInterface
187
    {
188
        foreach ($fixers as $fixer) {
2✔
189
            $this->addCustomFixer($fixer);
2✔
190
        }
191

192
        return $this;
2✔
193
    }
194

195
    /**
196
     * @param list<RuleSetDefinitionInterface> $ruleSets
197
     */
198
    public function registerCustomRuleSets(array $ruleSets): ConfigInterface
199
    {
200
        foreach ($ruleSets as $ruleset) {
1✔
201
            $this->customRuleSets[$ruleset->getName()] = $ruleset;
1✔
202
        }
203

204
        return $this;
1✔
205
    }
206

207
    /**
208
     * @param non-empty-string $cacheFile
209
     */
210
    public function setCacheFile(string $cacheFile): ConfigInterface
211
    {
212
        $this->cacheFile = $cacheFile;
2✔
213

214
        return $this;
2✔
215
    }
216

217
    public function setFinder(iterable $finder): ConfigInterface
218
    {
219
        $this->finder = $finder;
3✔
220

221
        return $this;
3✔
222
    }
223

224
    public function setFormat(string $format): ConfigInterface
225
    {
226
        $this->format = $format;
1✔
227

228
        return $this;
1✔
229
    }
230

231
    public function setHideProgress(bool $hideProgress): ConfigInterface
232
    {
233
        $this->hideProgress = $hideProgress;
1✔
234

235
        return $this;
1✔
236
    }
237

238
    /**
239
     * @param non-empty-string $indent
240
     */
241
    public function setIndent(string $indent): ConfigInterface
242
    {
243
        $this->indent = $indent;
1✔
244

245
        return $this;
1✔
246
    }
247

248
    /**
249
     * @param non-empty-string $lineEnding
250
     */
251
    public function setLineEnding(string $lineEnding): ConfigInterface
252
    {
253
        $this->lineEnding = $lineEnding;
1✔
254

255
        return $this;
1✔
256
    }
257

258
    public function setParallelConfig(ParallelConfig $config): ConfigInterface
259
    {
260
        $this->parallelConfig = $config;
1✔
261

262
        return $this;
1✔
263
    }
264

265
    public function setPhpExecutable(?string $phpExecutable): ConfigInterface
266
    {
267
        $this->phpExecutable = $phpExecutable;
1✔
268

269
        return $this;
1✔
270
    }
271

272
    public function setRiskyAllowed(bool $isRiskyAllowed): ConfigInterface
273
    {
274
        $this->isRiskyAllowed = $isRiskyAllowed;
×
275

276
        return $this;
×
277
    }
278

279
    public function setRules(array $rules): ConfigInterface
280
    {
281
        $this->rules = $rules;
×
282

283
        return $this;
×
284
    }
285

286
    public function setUsingCache(bool $usingCache): ConfigInterface
287
    {
288
        $this->usingCache = $usingCache;
1✔
289

290
        return $this;
1✔
291
    }
292

293
    public function setUnsupportedPhpVersionAllowed(bool $isUnsupportedPhpVersionAllowed): ConfigInterface
294
    {
295
        $this->isUnsupportedPhpVersionAllowed = $isUnsupportedPhpVersionAllowed;
1✔
296

297
        return $this;
1✔
298
    }
299

300
    private function addCustomFixer(FixerInterface $fixer): void
301
    {
302
        $this->customFixers[] = $fixer;
2✔
303
    }
304
}
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