Skip to content

Commit 8789f54

Browse files
committed
Updated PHP-CS-Fixer & StyleCI to match my coding style.
1 parent fcc0ad0 commit 8789f54

File tree

2 files changed

+115
-20
lines changed

2 files changed

+115
-20
lines changed

.php_cs.dist

Lines changed: 102 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,103 @@
11
<?php
2-
return PhpCsFixer\Config::create()
3-
->setRules(array(
4-
'@Symfony' => true,
5-
'@Symfony:risky' => true,
6-
'array_syntax' => array('syntax' => 'short'),
7-
'no_unreachable_default_argument_value' => false,
8-
'heredoc_to_nowdoc' => false,
9-
'phpdoc_annotation_without_dot' => false,
10-
))
11-
->setRiskyAllowed(true)
12-
->setFinder(
13-
PhpCsFixer\Finder::create()
14-
->in(__DIR__.'/src')
15-
->in(__DIR__.'/tests')
16-
)
17-
;
2+
$rules = [
3+
'array_syntax' => ['syntax' => 'short'],
4+
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
5+
'blank_line_after_namespace' => true,
6+
'blank_line_after_opening_tag' => true,
7+
'blank_line_before_return' => true,
8+
'braces' => true,
9+
'cast_spaces' => ['space' => 'none'],
10+
'class_definition' => true,
11+
'concat_space' => ['spacing' => 'one'],
12+
'declare_equal_normalize' => true,
13+
'elseif' => true,
14+
'encoding' => true,
15+
'full_opening_tag' => true,
16+
'function_declaration' => true,
17+
'function_typehint_space' => true,
18+
'hash_to_slash_comment' => true,
19+
'heredoc_to_nowdoc' => true,
20+
'include' => true,
21+
'indentation_type' => true,
22+
'line_ending' => true,
23+
'lowercase_cast' => true,
24+
'lowercase_constants' => true,
25+
'lowercase_keywords' => true,
26+
'method_argument_space' => true,
27+
'method_separation' => true,
28+
'native_function_casing' => true,
29+
'new_with_braces' => true,
30+
'normalize_index_brace' => true,
31+
'not_operator_with_space' => true,
32+
'no_alias_functions' => true,
33+
'no_blank_lines_after_class_opening' => true,
34+
'no_blank_lines_after_phpdoc' => true,
35+
'no_closing_tag' => true,
36+
'no_empty_phpdoc' => true,
37+
'no_empty_statement' => true,
38+
'no_extra_consecutive_blank_lines' => true,
39+
'no_leading_import_slash' => true,
40+
'no_leading_namespace_whitespace' => true,
41+
'no_mixed_echo_print' => ['use' => 'echo'],
42+
'no_multiline_whitespace_around_double_arrow' => true,
43+
'no_multiline_whitespace_before_semicolons' => true,
44+
'no_short_bool_cast' => true,
45+
'no_singleline_whitespace_before_semicolons' => true,
46+
'no_spaces_after_function_name' => true,
47+
'no_spaces_around_offset' => true,
48+
'no_spaces_inside_parenthesis' => true,
49+
'no_trailing_comma_in_list_call' => true,
50+
'no_trailing_comma_in_singleline_array' => true,
51+
'no_trailing_whitespace' => true,
52+
'no_trailing_whitespace_in_comment' => true,
53+
'no_unneeded_control_parentheses' => true,
54+
'no_unreachable_default_argument_value' => true,
55+
'no_unused_imports' => true,
56+
'no_useless_return' => true,
57+
'no_whitespace_before_comma_in_array' => true,
58+
'no_whitespace_in_blank_line' => true,
59+
'object_operator_without_whitespace' => true,
60+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
61+
'phpdoc_align' => true,
62+
'phpdoc_indent' => true,
63+
'phpdoc_inline_tag' => true,
64+
'phpdoc_no_access' => true,
65+
'phpdoc_no_alias_tag' => ['type' => 'var'],
66+
'phpdoc_no_package' => true,
67+
'phpdoc_order' => true,
68+
'phpdoc_scalar' => true,
69+
'phpdoc_separation' => true,
70+
'phpdoc_single_line_var_spacing' => true,
71+
'phpdoc_summary' => true,
72+
'phpdoc_to_comment' => true,
73+
'phpdoc_trim' => true,
74+
'phpdoc_types' => true,
75+
'phpdoc_var_without_name' => true,
76+
'psr4' => true,
77+
'self_accessor' => true,
78+
'short_scalar_cast' => true,
79+
'simplified_null_return' => true,
80+
'single_blank_line_at_eof' => true,
81+
'single_blank_line_before_namespace' => true,
82+
'single_class_element_per_statement' => true,
83+
'single_import_per_statement' => true,
84+
'single_line_after_imports' => true,
85+
'single_quote' => true,
86+
'space_after_semicolon' => true,
87+
'standardize_not_equals' => true,
88+
'switch_case_semicolon_to_colon' => true,
89+
'switch_case_space' => true,
90+
'ternary_operator_spaces' => true,
91+
'trailing_comma_in_multiline_array' => true,
92+
'trim_array_spaces' => true,
93+
'unary_operator_spaces' => true,
94+
'visibility_required' => true,
95+
'whitespace_after_comma_in_array' => true
96+
];
97+
98+
$finder = PhpCsFixer\Finder::create()->exclude([
99+
'node_modules',
100+
'vendor'
101+
])->in(__DIR__);
102+
103+
return PhpCsFixer\Config::create()->setRules($rules)->setFinder($finder)->setUsingCache(true)->setRiskyAllowed(true);

.styleci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
preset: symfony
1+
preset: recommended
2+
3+
enabled:
4+
- align_equals
5+
- concat_with_spaces
6+
- not_operator_with_space
7+
8+
disabled:
9+
- concat_without_spaces
10+
- unalign_equals
211

312
finder:
4-
path:
5-
- "src"
6-
- "tests"
13+
path:
14+
- "src"
15+
- "tests"

0 commit comments

Comments
 (0)