-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphp_cs.php
More file actions
102 lines (95 loc) · 3.14 KB
/
Copy pathphp_cs.php
File metadata and controls
102 lines (95 loc) · 3.14 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* This is the default PHP-CS-Fixer configs for PHPQA projects
*
* You can override this file by copying it into your qaConfig folder and editing as you see fit
*
* For rules, suggest you have a look at
*
* @see https://mlocati.github.io/php-cs-fixer-configurator/#version:2.16
*/
use Composer\Autoload\ClassLoader;
$rules = [
'@PhpCsFixer' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true,
],
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'final_class' => true,
'ordered_class_elements' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public',
'property_protected',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private',
],
# fights with PSR-12 in phpcs/phpcbf
'ordered_imports' => [
'sort_algorithm' => 'alpha',
# this is the PSR12 order, do not change
'imports_order' => [
'class',
'function',
'const',
],
],
'modernize_types_casting' => true,
'php_unit_strict' => [
'assertAttributeEquals',
'assertAttributeNotEquals',
'assertEquals',
'assertNotEquals',
],
'php_unit_size_class' => ['group' => 'small'],
'phpdoc_to_return_type' => true,
'psr4' => true,
'return_assignment' => true,
'self_accessor' => true,
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'ternary_to_null_coalescing' => true,
'void_return' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
],
'fully_qualified_strict_types' => true,
'method_argument_space' => [
'ensure_fully_multiline' => true,
'keep_multiple_spaces_after_comma' => true,
'on_multiline' => 'ensure_fully_multiline',
],
'single_line_throw' => false,
'global_namespace_import' => true,
];
$projectRoot = (
function () {
$reflection = new ReflectionClass(ClassLoader::class);
return dirname($reflection->getFileName(), 3);
}
)();
$finder = PhpCsFixer\Finder::create()
->in($projectRoot)
->exclude('var');
return PhpCsFixer\Config::create()
->setRules($rules)
->setFinder($finder);