-
-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy path.php-cs-fixer.dist.php
More file actions
72 lines (64 loc) · 2.32 KB
/
Copy path.php-cs-fixer.dist.php
File metadata and controls
72 lines (64 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$fileHeaderParts = [
<<<'EOF'
This file is part of the Symfony package.
(c) Fabien Potencier <[email protected]>
EOF,
<<<'EOF'
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF,
];
return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PHP8x4Migration' => true, // take lowest version from `git grep -h '"php"' **/composer.json | uniq | sort`
'@PHPUnit11x0Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'header_comment' => [
'header' => implode('', $fileHeaderParts),
'validator' => implode('', [
'/',
preg_quote($fileHeaderParts[0], '/'),
'(?P<EXTRA>.*)??',
preg_quote($fileHeaderParts[1], '/'),
'/s',
]),
],
])
->setRuleCustomisationPolicy(new class implements PhpCsFixer\Config\RuleCustomisationPolicyInterface {
public function getPolicyVersionForCache(): string
{
return hash_file('xxh128', __FILE__);
}
public function getRuleCustomisers(): array
{
return [
'void_return' => static function (SplFileInfo $file) {
// parallel workers pass a plain SplFileInfo, which has no getRelativePathname()
$pathname = str_replace('\\', '/', $file->getPathname());
// `src/*/src/Test/` ships test helpers meant to be extended by users, adding a native return type there would break their subclasses
return !str_contains($pathname, '/src/Test/');
},
];
}
})
->setRiskyAllowed(true)
->setFinder((new PhpCsFixer\Finder())
->in(__DIR__)
->notPath('#/Fixtures/#')
->notPath('#/assets/#')
->notPath('#/var/#')
// apps/
->notPath(['#config/#', '#public/#', 'importmap.php'])
)
;