-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.dist.php
60 lines (54 loc) · 2.01 KB
/
.php-cs-fixer.dist.php
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
<?php
$workingDirectory = __DIR__;
$srcDirectory = $workingDirectory . '/src';
$unitTestDirectory = $workingDirectory . '/tests/Unit';
if (is_readable($srcDirectory) === false) {
throw new RuntimeException('Unable to find ./src directory. What did you do??!');
}
if (is_readable($unitTestDirectory) === false) {
throw new RuntimeException('Unable to find ./tests/Unit directory. What did you do??!');
}
$finder = PhpCsFixer\Finder::create()
->in($srcDirectory)
->in($unitTestDirectory);
$config = new PhpCsFixer\Config();
return $config->setRules([
// [PER:risky & Symfony:risky source: https://cs.symfony.com/doc/ruleSets/PhpCsFixerRisky.html]
'@PER' => true,
'@PHP82Migration' => true,
'@PhpCsFixer:risky' => true,
'@Symfony:risky' => true,
'@Symfony' => true,
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
'declare_strict_types' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'phpdoc_to_param_type' => true,
'date_time_immutable' => true,
'not_operator_with_successor_space' => true,
'method_chaining_indentation' => true,
'single_line_throw' => false,
'single_quote' => ['strings_containing_single_quote_chars' => true],
'cast_spaces' => ['space' => 'single'],
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try']],
'phpdoc_align' => [
'align' => 'left',
'tags' => ['method', 'param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var'],
],
'no_extra_blank_lines' => [
'tokens' => [
'attribute',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'switch',
'throw',
'use',
],
],
])
->setFinder($finder)
->setRiskyAllowed(true);