Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 0b9e5d6

Browse files
add php-cs-fixer config
1 parent 54994c0 commit 0b9e5d6

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

.php_cs

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?php
2+
3+
/**
4+
* PHP CS Fixer configuration
5+
*
6+
* @see https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
7+
*/
8+
$finder = \PhpCsFixer\Finder::create()
9+
->in(__DIR__)
10+
->exclude([
11+
'bootstrap',
12+
'storage',
13+
'vendor',
14+
])
15+
->name('*.php')
16+
->name('_ide_helper')
17+
->notName('*.blade.php')
18+
->notName('index.php')
19+
->notName('server.php')
20+
->ignoreDotFiles(true)
21+
->ignoreVCS(true);
22+
23+
return PhpCsFixer\Config::create()
24+
->setRiskyAllowed(true)
25+
->setUsingCache(true)
26+
->setRules([
27+
'binary_operator_spaces' => [
28+
'operators' => ['=>' => null]
29+
],
30+
'blank_line_after_namespace' => true,
31+
'blank_line_after_opening_tag' => true,
32+
'blank_line_before_statement' => true,
33+
'braces' => true,
34+
'cast_spaces' => true,
35+
'class_definition' => true,
36+
'concat_space' => true,
37+
'declare_equal_normalize' => true,
38+
'elseif' => true,
39+
'encoding' => true,
40+
'full_opening_tag' => true,
41+
'function_declaration' => true,
42+
'function_typehint_space' => true,
43+
'single_line_comment_style' => [
44+
'comment_types' => ['hash']
45+
],
46+
'heredoc_to_nowdoc' => true,
47+
'include' => true,
48+
'indentation_type' => true,
49+
'linebreak_after_opening_tag' => true,
50+
'lowercase_cast' => true,
51+
'lowercase_constants' => true,
52+
'lowercase_keywords' => true,
53+
'magic_constant_casing' => true,
54+
'method_argument_space' => true,
55+
'class_attributes_separation' => true,
56+
'visibility_required' => true,
57+
'native_function_casing' => true,
58+
'no_alias_functions' => true,
59+
'no_extra_blank_lines' => [
60+
'tokens' => [
61+
'extra',
62+
'throw',
63+
'use',
64+
'use_trait',
65+
]
66+
],
67+
'no_blank_lines_after_class_opening' => true,
68+
'no_blank_lines_after_phpdoc' => true,
69+
'no_closing_tag' => true,
70+
'no_empty_phpdoc' => true,
71+
'no_empty_statement' => true,
72+
'no_leading_import_slash' => true,
73+
'no_leading_namespace_whitespace' => true,
74+
'no_multiline_whitespace_around_double_arrow' => true,
75+
'multiline_whitespace_before_semicolons' => true,
76+
'no_short_bool_cast' => true,
77+
'no_singleline_whitespace_before_semicolons' => true,
78+
'no_spaces_after_function_name' => true,
79+
'no_spaces_around_offset' => true,
80+
'no_spaces_inside_parenthesis' => true,
81+
'no_trailing_comma_in_list_call' => true,
82+
'no_trailing_comma_in_singleline_array' => true,
83+
'no_trailing_whitespace' => true,
84+
'no_trailing_whitespace_in_comment' => true,
85+
'no_unneeded_control_parentheses' => true,
86+
'no_unreachable_default_argument_value' => true,
87+
'no_useless_return' => true,
88+
'no_whitespace_before_comma_in_array' => true,
89+
'no_whitespace_in_blank_line' => true,
90+
'normalize_index_brace' => true,
91+
'not_operator_with_successor_space' => true,
92+
'object_operator_without_whitespace' => true,
93+
'ordered_imports' => ['sortAlgorithm' => 'length'],
94+
'phpdoc_indent' => true,
95+
'phpdoc_inline_tag' => true,
96+
'phpdoc_no_access' => true,
97+
'phpdoc_no_package' => true,
98+
'phpdoc_no_useless_inheritdoc' => true,
99+
'phpdoc_scalar' => true,
100+
'phpdoc_single_line_var_spacing' => true,
101+
'phpdoc_summary' => true,
102+
'phpdoc_to_comment' => true,
103+
'phpdoc_trim' => true,
104+
'phpdoc_types' => true,
105+
'phpdoc_var_without_name' => true,
106+
'increment_style' => ['style' => 'post'],
107+
'no_mixed_echo_print' => true,
108+
'psr4' => true,
109+
'self_accessor' => true,
110+
'array_syntax' => ['syntax' => 'short'],
111+
'short_scalar_cast' => true,
112+
'simplified_null_return' => true,
113+
'single_blank_line_at_eof' => true,
114+
'single_blank_line_before_namespace' => true,
115+
'single_class_element_per_statement' => true,
116+
'single_import_per_statement' => true,
117+
'single_line_after_imports' => true,
118+
'single_quote' => true,
119+
'space_after_semicolon' => true,
120+
'standardize_not_equals' => true,
121+
'switch_case_semicolon_to_colon' => true,
122+
'switch_case_space' => true,
123+
'ternary_operator_spaces' => true,
124+
'trailing_comma_in_multiline_array' => true,
125+
'trim_array_spaces' => true,
126+
'unary_operator_spaces' => true,
127+
'line_ending' => true,
128+
'whitespace_after_comma_in_array' => true,
129+
'lowercase_static_reference' => true, // added from Symfony
130+
'magic_method_casing' => true, // added from Symfony
131+
'fully_qualified_strict_types' => true, // added
132+
])
133+
->setFinder($finder);

0 commit comments

Comments
 (0)