Skip to content

Commit da50d37

Browse files
authored
ci: replace StyleCI with GitHub Workflows (#79)
1 parent 77e891f commit da50d37

File tree

3 files changed

+168
-108
lines changed

3 files changed

+168
-108
lines changed

.github/workflows/format.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Format
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.php'
7+
8+
jobs:
9+
php-cs-fixer:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v1
14+
15+
- name: Install
16+
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist --optimize-autoloader
17+
18+
- name: Run php-cs-fixer
19+
run: ./vendor/bin/php-cs-fixer fix
20+
21+
- uses: stefanzweifel/[email protected]
22+
with:
23+
commit_message: "style: resolve style guide violations"
24+
branch: ${{ github.head_ref }}
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.php_cs

Lines changed: 142 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,145 @@
11
<?php
22

3-
return PhpCsFixer\Config::create()
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$rules = [
7+
'array_syntax' => ['syntax' => 'short'],
8+
'binary_operator_spaces' => [
9+
'align_double_arrow' => true,
10+
'align_equals' => true,
11+
],
12+
'blank_line_after_namespace' => true,
13+
'blank_line_after_opening_tag' => true,
14+
'blank_line_before_return' => true,
15+
'blank_line_before_statement' => true,
16+
'braces' => true,
17+
'cast_spaces' => true,
18+
'class_attributes_separation' => true,
19+
'class_definition' => true,
20+
'combine_consecutive_unsets' => true,
21+
'concat_space' => true,
22+
'declare_equal_normalize' => true,
23+
'elseif' => true,
24+
'encoding' => true,
25+
'full_opening_tag' => true,
26+
'fully_qualified_strict_types' => true, // added by Shift
27+
'function_declaration' => true,
28+
'function_typehint_space' => true,
29+
'heredoc_to_nowdoc' => true,
30+
'include' => true,
31+
'increment_style' => ['style' => 'post'],
32+
'indentation_type' => true,
33+
'line_ending' => true,
34+
'linebreak_after_opening_tag' => true,
35+
'list_syntax' => ['syntax' => 'short'],
36+
'lowercase_cast' => true,
37+
'lowercase_constants' => true,
38+
'lowercase_keywords' => true,
39+
'lowercase_static_reference' => true, // added from Symfony
40+
'magic_constant_casing' => true,
41+
'magic_method_casing' => true, // added from Symfony
42+
'method_argument_space' => true,
43+
'method_separation' => true,
44+
'multiline_whitespace_before_semicolons' => true,
45+
'native_function_casing' => true,
46+
'new_with_braces' => true,
47+
'no_alias_functions' => true,
48+
'no_blank_lines_after_class_opening' => true,
49+
'no_blank_lines_after_phpdoc' => true,
50+
'no_closing_tag' => true,
51+
'no_empty_phpdoc' => true,
52+
'no_empty_statement' => true,
53+
'no_extra_blank_lines' => true,
54+
'no_extra_consecutive_blank_lines' => true,
55+
'no_leading_import_slash' => true,
56+
'no_leading_namespace_whitespace' => true,
57+
'no_mixed_echo_print' => true,
58+
'no_multiline_whitespace_around_double_arrow' => true,
59+
'no_multiline_whitespace_before_semicolons' => true,
60+
'no_short_bool_cast' => true,
61+
'no_short_echo_tag' => true,
62+
'no_singleline_whitespace_before_semicolons' => true,
63+
'no_spaces_after_function_name' => true,
64+
'no_spaces_around_offset' => true,
65+
'no_spaces_inside_parenthesis' => true,
66+
'no_trailing_comma_in_list_call' => true,
67+
'no_trailing_comma_in_singleline_array' => true,
68+
'no_trailing_whitespace_in_comment' => true,
69+
'no_trailing_whitespace' => true,
70+
'no_unneeded_control_parentheses' => true,
71+
'no_unreachable_default_argument_value' => true,
72+
'no_unused_imports' => true,
73+
'no_useless_else' => true,
74+
'no_useless_return' => true,
75+
'no_whitespace_before_comma_in_array' => true,
76+
'no_whitespace_in_blank_line' => true,
77+
'normalize_index_brace' => true,
78+
'not_operator_with_successor_space' => true,
79+
'object_operator_without_whitespace' => true,
80+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
81+
'php_unit_strict' => true,
82+
'php_unit_test_class_requires_covers' => true,
83+
'phpdoc_add_missing_param_annotation' => true,
84+
'phpdoc_align' => true,
85+
'phpdoc_indent' => true,
86+
'phpdoc_inline_tag' => true,
87+
'phpdoc_no_access' => true,
88+
'phpdoc_no_package' => true,
89+
'phpdoc_no_useless_inheritdoc' => true,
90+
'phpdoc_order' => true,
91+
'phpdoc_scalar' => true,
92+
'phpdoc_separation' => true,
93+
'phpdoc_single_line_var_spacing' => true,
94+
'phpdoc_summary' => true,
95+
'phpdoc_to_comment' => true,
96+
'phpdoc_trim' => true,
97+
'phpdoc_types' => true,
98+
'phpdoc_var_without_name' => true,
99+
'psr4' => true,
100+
'self_accessor' => true,
101+
'semicolon_after_instruction' => true,
102+
'short_scalar_cast' => true,
103+
'simplified_null_return' => true,
104+
'single_blank_line_at_eof' => true,
105+
'single_blank_line_before_namespace' => true,
106+
'single_class_element_per_statement' => true,
107+
'single_import_per_statement' => true,
108+
'single_line_after_imports' => true,
109+
'single_line_comment_style' => [
110+
'comment_types' => ['hash']
111+
],
112+
'single_quote' => true,
113+
'space_after_semicolon' => true,
114+
'standardize_not_equals' => true,
115+
'strict_comparison' => true,
116+
'strict_param' => true,
117+
'switch_case_semicolon_to_colon' => true,
118+
'switch_case_space' => true,
119+
'ternary_operator_spaces' => true,
120+
'trailing_comma_in_multiline_array' => true,
121+
'trim_array_spaces' => true,
122+
'unary_operator_spaces' => true,
123+
'visibility_required' => true,
124+
'whitespace_after_comma_in_array' => true,
125+
126+
];
127+
128+
$finder = Finder::create()
129+
->notPath('bootstrap')
130+
->notPath('storage')
131+
->notPath('vendor')
132+
->in(getcwd())
133+
->name('*.php')
134+
->notName('*.blade.php')
135+
->notName('index.php')
136+
->notName('server.php')
137+
->notName('_ide_helper.php')
138+
->ignoreDotFiles(true)
139+
->ignoreVCS(true);
140+
141+
return Config::create()
142+
->setFinder($finder)
143+
->setRules($rules)
4144
->setRiskyAllowed(true)
5-
->setRules([
6-
'@PHP56Migration' => true,
7-
'@Symfony' => true,
8-
'@Symfony:risky' => true,
9-
'array_syntax' => ['syntax' => 'short'],
10-
'binary_operator_spaces' => [
11-
'align_double_arrow' => true,
12-
'align_equals' => true,
13-
],
14-
'blank_line_after_namespace' => true,
15-
'blank_line_after_opening_tag' => true,
16-
'blank_line_before_return' => true,
17-
'braces' => true,
18-
'cast_spaces' => true,
19-
'class_definition' => true,
20-
'combine_consecutive_unsets' => true,
21-
'declare_equal_normalize' => true,
22-
'elseif' => true,
23-
'encoding' => true,
24-
'full_opening_tag' => true,
25-
'function_declaration' => true,
26-
'function_typehint_space' => true,
27-
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
28-
'hash_to_slash_comment' => true,
29-
'heredoc_to_nowdoc' => true,
30-
'include' => true,
31-
'list_syntax' => ['syntax' => 'long'],
32-
'lowercase_cast' => true,
33-
'lowercase_constants' => true,
34-
'lowercase_keywords' => true,
35-
'method_argument_space' => true,
36-
'method_separation' => true,
37-
'native_function_casing' => true,
38-
'new_with_braces' => true,
39-
'no_alias_functions' => true,
40-
'no_blank_lines_after_class_opening' => true,
41-
'no_blank_lines_after_phpdoc' => true,
42-
'no_closing_tag' => true,
43-
'no_empty_phpdoc' => true,
44-
'no_empty_statement' => true,
45-
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
46-
'no_extra_consecutive_blank_lines' => true,
47-
'no_leading_import_slash' => true,
48-
'no_leading_namespace_whitespace' => true,
49-
'no_multiline_whitespace_around_double_arrow' => true,
50-
'no_multiline_whitespace_before_semicolons' => true,
51-
'no_short_bool_cast' => true,
52-
'no_short_echo_tag' => true,
53-
'no_singleline_whitespace_before_semicolons' => true,
54-
'no_spaces_after_function_name' => true,
55-
'no_spaces_inside_parenthesis' => true,
56-
'no_trailing_comma_in_list_call' => true,
57-
'no_trailing_comma_in_singleline_array' => true,
58-
'no_trailing_whitespace' => true,
59-
'no_trailing_whitespace_in_comment' => true,
60-
'no_unneeded_control_parentheses' => true,
61-
'no_unreachable_default_argument_value' => true,
62-
'no_unused_imports' => true,
63-
'no_useless_else' => true,
64-
'no_useless_return' => true,
65-
'no_whitespace_before_comma_in_array' => true,
66-
'no_whitespace_in_blank_line' => true,
67-
'normalize_index_brace' => true,
68-
'object_operator_without_whitespace' => true,
69-
'ordered_class_elements' => true,
70-
'ordered_imports' => true,
71-
'php_unit_strict' => true,
72-
'php_unit_test_class_requires_covers' => true,
73-
'phpdoc_add_missing_param_annotation' => true,
74-
'phpdoc_align' => true,
75-
'phpdoc_indent' => true,
76-
'phpdoc_inline_tag' => true,
77-
'phpdoc_no_access' => true,
78-
'phpdoc_no_package' => true,
79-
'phpdoc_order' => true,
80-
'phpdoc_scalar' => true,
81-
'phpdoc_separation' => true,
82-
'phpdoc_single_line_var_spacing' => true,
83-
'phpdoc_summary' => true,
84-
'phpdoc_to_comment' => true,
85-
'phpdoc_trim' => true,
86-
'phpdoc_types' => true,
87-
'phpdoc_var_without_name' => true,
88-
'psr4' => true,
89-
'self_accessor' => true,
90-
'semicolon_after_instruction' => true,
91-
'short_scalar_cast' => true,
92-
'simplified_null_return' => true,
93-
'single_blank_line_at_eof' => true,
94-
'single_blank_line_before_namespace' => true,
95-
'single_class_element_per_statement' => true,
96-
'single_import_per_statement' => true,
97-
'single_line_after_imports' => true,
98-
'single_quote' => true,
99-
'space_after_semicolon' => true,
100-
'standardize_not_equals' => true,
101-
'strict_comparison' => true,
102-
'strict_param' => true,
103-
'switch_case_semicolon_to_colon' => true,
104-
'switch_case_space' => true,
105-
'ternary_operator_spaces' => true,
106-
'trailing_comma_in_multiline_array' => true,
107-
'trim_array_spaces' => true,
108-
'unary_operator_spaces' => true,
109-
'whitespace_after_comma_in_array' => true,
110-
]);
145+
->setUsingCache(true);

.styleci.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)