Skip to content

Commit 8080043

Browse files
authored
Merge pull request #6 from kool-dev/cs-fixer
Update php-cs-fixer
2 parents 069fa61 + 0560f2d commit 8080043

File tree

2 files changed

+201
-12
lines changed

2 files changed

+201
-12
lines changed

laravel/.php_cs

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<?php
2+
3+
$path = __DIR__ . DIRECTORY_SEPARATOR;
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->in($path . 'app')
7+
->in($path . 'config')
8+
->in($path . 'database')
9+
->in($path . 'resources')
10+
->in($path . 'routes')
11+
->in($path . 'tests')
12+
->name('*.php')
13+
->notName('*.blade.php')
14+
->ignoreDotFiles(true)
15+
->ignoreVCS(true);
16+
17+
$rules = [
18+
'align_multiline_comment' => true,
19+
'array_indentation' => true,
20+
'array_syntax' => [
21+
'syntax' => 'short',
22+
],
23+
'backtick_to_shell_exec' => true,
24+
'binary_operator_spaces' => true,
25+
'blank_line_after_namespace' => true,
26+
'blank_line_after_opening_tag' => true,
27+
'blank_line_before_statement' => true,
28+
'braces' => true,
29+
'cast_spaces' => true,
30+
'class_attributes_separation' => [
31+
'elements' => [
32+
'method',
33+
],
34+
],
35+
'class_definition' => [
36+
'single_line' => true,
37+
],
38+
'class_keyword_remove' => false,
39+
'combine_consecutive_issets' => true,
40+
'combine_consecutive_unsets' => true,
41+
'combine_nested_dirname' => true,
42+
'compact_nullable_typehint' => true,
43+
'concat_space' => [
44+
'spacing' => 'one',
45+
],
46+
'date_time_immutable' => true,
47+
'declare_equal_normalize' => true,
48+
'dir_constant' => true,
49+
'elseif' => true,
50+
'encoding' => true,
51+
'error_suppression' => true,
52+
'escape_implicit_backslashes' => true,
53+
'explicit_indirect_variable' => true,
54+
'explicit_string_variable' => true,
55+
'fopen_flag_order' => true,
56+
'fopen_flags' => [
57+
'b_mode' => false,
58+
],
59+
'full_opening_tag' => true,
60+
'fully_qualified_strict_types' => true,
61+
'function_declaration' => true,
62+
'function_to_constant' => true,
63+
'function_typehint_space' => true,
64+
'heredoc_indentation' => true,
65+
'heredoc_to_nowdoc' => true,
66+
'implode_call' => true,
67+
'include' => true,
68+
'increment_style' => false,
69+
'indentation_type' => true,
70+
'is_null' => true,
71+
'line_ending' => true,
72+
'linebreak_after_opening_tag' => true,
73+
'list_syntax' => [
74+
'syntax' => 'short',
75+
],
76+
'logical_operators' => true,
77+
'lowercase_cast' => true,
78+
'lowercase_constants' => true,
79+
'lowercase_keywords' => true,
80+
'lowercase_static_reference' => true,
81+
'magic_constant_casing' => true,
82+
'magic_method_casing' => true,
83+
'mb_str_functions' => true,
84+
'method_argument_space' => [
85+
'on_multiline' => 'ensure_fully_multiline',
86+
],
87+
'modernize_types_casting' => true,
88+
'multiline_comment_opening_closing' => true,
89+
'multiline_whitespace_before_semicolons' => true,
90+
'native_function_casing' => true,
91+
'native_function_type_declaration_casing' => true, // xxxx
92+
'new_with_braces' => true,
93+
'no_alternative_syntax' => true,
94+
'no_binary_string' => true,
95+
'no_blank_lines_after_class_opening' => true,
96+
'no_blank_lines_after_phpdoc' => true,
97+
'no_blank_lines_before_namespace' => false,
98+
'no_break_comment' => true,
99+
'no_closing_tag' => true,
100+
'no_empty_comment' => true,
101+
'no_empty_phpdoc' => true,
102+
'no_empty_statement' => true,
103+
'no_extra_blank_lines' => [
104+
'tokens' => [
105+
'continue',
106+
'curly_brace_block',
107+
'extra',
108+
'parenthesis_brace_block',
109+
'square_brace_block',
110+
'throw',
111+
'use_trait',
112+
'switch',
113+
'case',
114+
'default',
115+
],
116+
],
117+
'no_homoglyph_names' => true,
118+
'no_leading_import_slash' => true,
119+
'no_leading_namespace_whitespace' => true,
120+
'no_mixed_echo_print' => true,
121+
'no_multiline_whitespace_around_double_arrow' => true,
122+
'no_null_property_initialization' => true,
123+
'no_short_bool_cast' => true,
124+
'no_short_echo_tag' => true,
125+
'no_singleline_whitespace_before_semicolons' => true,
126+
'no_spaces_after_function_name' => true,
127+
'no_spaces_around_offset' => true,
128+
'no_spaces_inside_parenthesis' => true,
129+
'no_superfluous_elseif' => true,
130+
'no_superfluous_phpdoc_tags' => true,
131+
'no_trailing_comma_in_singleline_array' => true,
132+
'no_trailing_whitespace' => true,
133+
'no_trailing_whitespace_in_comment' => true,
134+
'no_unneeded_control_parentheses' => true,
135+
'no_unneeded_curly_braces' => true,
136+
'no_unneeded_final_method' => true,
137+
'no_unreachable_default_argument_value' => true,
138+
'no_unset_cast' => true,
139+
'no_unused_imports' => true,
140+
'no_useless_else' => true,
141+
'no_useless_return' => true,
142+
'no_whitespace_before_comma_in_array' => true,
143+
'no_whitespace_in_blank_line' => true,
144+
'normalize_index_brace' => true,
145+
'not_operator_with_space' => false,
146+
'not_operator_with_successor_space' => true,
147+
'object_operator_without_whitespace' => true,
148+
'ordered_class_elements' => [
149+
'order' => [
150+
'use_trait',
151+
'constant', 'constant_public', 'constant_protected', 'constant_private',
152+
'property_static', 'property_public_static', 'property_protected_static', 'property_private_static',
153+
'property', 'property_public', 'property_protected', 'property_private',
154+
'construct', 'destruct', 'magic',
155+
'method', 'method_public', 'method_protected', 'method_private',
156+
'method_static', 'method_public_static', 'method_protected_static', 'method_private_static',
157+
'phpunit',
158+
],
159+
],
160+
'pow_to_exponentiation' => true,
161+
'return_assignment' => true,
162+
'return_type_declaration' => true,
163+
'self_accessor' => true,
164+
'semicolon_after_instruction' => true,
165+
'short_scalar_cast' => true,
166+
'simple_to_complex_string_variable' => true,
167+
'simplified_null_return' => true,
168+
'single_blank_line_at_eof' => true,
169+
'single_blank_line_before_namespace' => true,
170+
'single_class_element_per_statement' => true,
171+
'single_import_per_statement' => true,
172+
'single_line_after_imports' => true,
173+
'single_line_comment_style' => true,
174+
'single_quote' => true,
175+
'single_trait_insert_per_statement' => true,
176+
'space_after_semicolon' => [
177+
'remove_in_empty_for_expressions' => true,
178+
],
179+
'standardize_increment' => true,
180+
'standardize_not_equals' => true,
181+
'switch_case_semicolon_to_colon' => true,
182+
'switch_case_space' => true,
183+
'ternary_operator_spaces' => true,
184+
'ternary_to_null_coalescing' => true,
185+
'trailing_comma_in_multiline_array' => true,
186+
'trim_array_spaces' => true,
187+
'unary_operator_spaces' => true,
188+
'visibility_required' => true,
189+
'whitespace_after_comma_in_array' => true,
190+
];
191+
192+
return PhpCsFixer\Config::create()
193+
->setRiskyAllowed(true)
194+
->setFinder($finder)
195+
->setRules($rules)
196+
->setHideProgress(true)
197+
->setUsingCache(true);

laravel/gitlab/index.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ <h1 class="jumbotron-heading">Laravel continuous integration on GitLab CI/CD</h1
2525
<a href="variables.yml" class="btn btn-secondary btn-sm my-2">variables.yml</a>
2626
<a href="assets.yml" class="btn btn-secondary btn-sm my-2">assets.yml</a>
2727
<a href="cs-fixer.yml" class="btn btn-secondary btn-sm my-2">cs-fixer.yml</a>
28+
<a href="../.php_cs" class="btn btn-warning btn-sm my-2">.php_cs</a>
2829
<a href="dusk.yml" class="btn btn-secondary btn-sm my-2">dusk.yml</a>
2930
<a href="eslint.yml" class="btn btn-secondary btn-sm my-2">eslint.yml</a>
3031
<a href="phan.yml" class="btn btn-secondary btn-sm my-2">phan.yml</a>
@@ -120,18 +121,9 @@ <h3>GitLab CI/CD configuration for a Laravel application running with Kool.dev</
120121
start:chrome: kool docker -- --name="chromedriver" --network=$KOOL_GLOBAL_NETWORK -d --shm-size=256M fireworkweb/chromedriver:latest
121122
stop:chrome: docker stop chromedriver
122123
dusk: kool run artisan dusk
123-
php-cs-fixer-check:
124-
- kool run phpqa php-cs-fixer fix --diff --dry-run app/
125-
- kool run phpqa php-cs-fixer fix --diff --dry-run tests/
126-
- kool run phpqa php-cs-fixer fix --diff --dry-run resources/lang
127-
- kool run phpqa php-cs-fixer fix --diff --dry-run config
128-
- kool run phpqa php-cs-fixer fix --diff --dry-run database
129-
php-cs-fixer:
130-
- kool run phpqa php-cs-fixer fix --diff --format=txt --verbose app/
131-
- kool run phpqa php-cs-fixer fix --diff --format=txt --verbose tests/
132-
- kool run phpqa php-cs-fixer fix --diff --format=txt --verbose resources/lang
133-
- kool run phpqa php-cs-fixer fix --diff --format=txt --verbose config
134-
- kool run phpqa php-cs-fixer fix --diff --format=txt --verbose database</pre>
124+
php-cs-fixer: kool run phpqa php-cs-fixer fix --diff --diff-format=udiff --verbose
125+
php-cs-fixer-check: kool run php-cs-fixer --dry-run
126+
</pre>
135127
</div>
136128
</div>
137129
</section>

0 commit comments

Comments
 (0)