-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.dist.php
87 lines (85 loc) · 2.95 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
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
<?php
$copyrightYear = date('Y');
$header = <<<EOT
Aphiria
@link https://www.aphiria.com
@copyright Copyright (C) {$copyrightYear} David Young
@license https://github.com/aphiria/aphiria/blob/1.x/LICENSE.md
EOT;
return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_strict_types' => true,
'function_typehint_space' => true,
'header_comment' => [
'header' => $header,
'comment_type' => 'PHPDoc',
'location' => 'after_open'
],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
// A very tiny micro-optimization to reduce the number of opcodes for native function calls
'native_function_invocation' => ['include' => ['@all']],
'new_with_braces' => true,
'no_empty_comment' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_unneeded_control_parentheses' => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
'yield_from'
]
],
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
'case',
'constant_public',
'constant_protected',
'constant_private',
'property_public_static',
'property_public_readonly',
'property_public',
'property_protected_static',
'property_protected_readonly',
'property_protected',
'property_private_static',
'property_private_readonly',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
'method_public_static',
'method_public_abstract',
'method_public',
'method_protected_static',
'method_protected_abstract',
'method_protected',
'method_private_static',
'method_private'
],
],
'ordered_imports' => true,
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'standardize_not_equals' => true
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()->in(__DIR__)
);