-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy path.php-cs-fixer.dist.php
More file actions
65 lines (60 loc) · 2.74 KB
/
Copy path.php-cs-fixer.dist.php
File metadata and controls
65 lines (60 loc) · 2.74 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
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Config\RuleCustomisationPolicyInterface;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
return (new Config())
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHPUnit7x5Migration:risky' => true,
'php_unit_dedicate_assert' => ['target' => '5.6'],
'array_syntax' => ['syntax' => 'short'],
'php_unit_fqcn_annotation' => true,
'no_unreachable_default_argument_value' => false,
'heredoc_to_nowdoc' => false,
'single_line_throw' => false,
'ordered_imports' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'allow_unused_params' => true],
])
->setRuleCustomisationPolicy(new class implements RuleCustomisationPolicyInterface {
public function getPolicyVersionForCache(): string
{
return hash_file('xxh128', __FILE__);
}
public function getRuleCustomisers(): array
{
return [
'void_return' => static function (\SplFileInfo $file) {
$pathname = str_replace('\\', '/', $file->getPathname());
// These files intentionally omit void return types on extension points to preserve Twig 3.x subclass compatibility.
foreach ([
'extra/twig-extra-bundle/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php',
'extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php',
'extra/twig-extra-bundle/TwigExtraBundle.php',
'src/Environment.php',
'src/Extension/ProfilerExtension.php',
'src/Node/CheckSecurityCallNode.php',
'src/Node/Expression/CallExpression.php',
'src/Node/Expression/FunctionExpression.php',
'src/Node/IncludeNode.php',
'src/Node/Node.php',
'src/Node/TypesNode.php',
'src/Parser.php',
'src/Test/IntegrationTestCase.php',
'src/Test/NodeTestCase.php',
] as $excludedPathname) {
if ($excludedPathname === $pathname || str_ends_with($pathname, '/'.$excludedPathname)) {
return false;
}
}
return true;
},
];
}
})
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setFinder((new Finder())->in(__DIR__))
;