-
Notifications
You must be signed in to change notification settings - Fork 28
/
.php-cs-fixer.dist.php
80 lines (77 loc) · 3.98 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
<?php
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/routes',
__DIR__ . '/config',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR2' => true,
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => true
],
'array_syntax' => [
'syntax' => 'short'
],
'ordered_imports' => [
'sort_algorithm' => 'length'
],
'blank_line_before_statement' => [
'statements' => ['break', 'case', 'continue', 'declare', 'default', 'do', 'exit', 'for', 'foreach', 'goto', 'if', 'include', 'include_once', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'while', 'yield', 'yield_from'],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'no_extra_blank_lines' => [
'tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait'],
],
'cast_spaces' => [
'space' => 'single'
],
'use_arrow_functions' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'single_space_after_construct' => true,
'single_line_after_imports' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => ['operators' => ['=>' => 'align']],
'single_trait_insert_per_statement' => false,
'method_chaining_indentation' => true,
'array_indentation' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_empty_statement' => true,
'standardize_increment' => true,
'object_operator_without_whitespace' => true,
'ternary_operator_spaces' => true,
'no_leading_namespace_whitespace' => true,
'no_blank_lines_before_namespace' => true,
'blank_line_after_namespace' => true,
'fully_qualified_strict_types' => true,
'single_line_throw' => true,
'function_typehint_space' => true,
'simplified_if_return' => true,
'no_useless_else' => true,
'no_unneeded_curly_braces' => true,
'no_empty_comment' => true,
'no_blank_lines_after_class_opening' => true,
'whitespace_after_comma_in_array' => true,
'trim_array_spaces' => true,
'no_whitespace_before_comma_in_array' => true,
'constant_case' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'lambda_not_used_import' => true,
])
->setFinder($finder);