Skip to content

Commit 1d4e379

Browse files
committed
Added php_cs
1 parent 0689a04 commit 1d4e379

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1265
-1350
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/phpunit.xml export-ignore
1111
/infection.json.dist export-ignore
1212
/.phan export-ignore
13+
/.php_cs.dist export-ignore

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ composer.lock
33
infection.log
44
/vendor/
55
.idea/
6+
.php_cs.cache
67
*.swp

.php_cs.dist

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in('src')
5+
->in('tests')
6+
;
7+
8+
return PhpCsFixer\Config::create()
9+
->setRiskyAllowed(true)
10+
->setRules([
11+
'array_indentation' => true,
12+
'array_syntax' => ['syntax' => 'short'],
13+
'binary_operator_spaces' => ['align_double_arrow'=>true],
14+
'blank_line_after_namespace' => true,
15+
'blank_line_after_opening_tag' => true,
16+
'blank_line_before_statement' => ['statements'=>['return']],
17+
'braces' => ['allow_single_line_closure' => false],
18+
'cast_spaces' => true,
19+
'class_attributes_separation' => ['elements'=>['method']],
20+
'class_definition' => ['single_line'=>true],
21+
'combine_consecutive_issets' => true,
22+
'concat_space' => ['spacing' => 'one'],
23+
'declare_equal_normalize' => true,
24+
'elseif' => true,
25+
'encoding' => true,
26+
'full_opening_tag' => true,
27+
'function_declaration' => true,
28+
'function_typehint_space' => true,
29+
'include' => true,
30+
'increment_style' => true,
31+
'indentation_type' => true,
32+
'line_ending' => true,
33+
'linebreak_after_opening_tag' => true,
34+
'lowercase_cast' => true,
35+
'lowercase_keywords' => true,
36+
'lowercase_static_reference' => true,
37+
'magic_constant_casing' => true,
38+
'magic_method_casing' => true,
39+
'mb_str_functions' => false,
40+
'method_argument_space' => true,
41+
'native_function_casing' => true,
42+
'native_function_invocation' => true,
43+
'native_function_type_declaration_casing' => true,
44+
'new_with_braces' => true,
45+
'no_blank_lines_after_class_opening' => true,
46+
'no_blank_lines_after_phpdoc' => true,
47+
'no_break_comment' => true,
48+
'no_closing_tag' => true,
49+
'no_empty_comment' => true,
50+
'no_empty_phpdoc' => true,
51+
'no_empty_statement' => true,
52+
'no_extra_blank_lines' => ['tokens'=>[
53+
'curly_brace_block',
54+
'extra',
55+
'parenthesis_brace_block',
56+
'square_brace_block',
57+
'throw',
58+
'use',
59+
]],
60+
'no_leading_import_slash' => true,
61+
'no_leading_namespace_whitespace' => true,
62+
'no_mixed_echo_print' => true,
63+
'no_multiline_whitespace_around_double_arrow' => true,
64+
'no_null_property_initialization' => true,
65+
'no_short_bool_cast' => true,
66+
'no_singleline_whitespace_before_semicolons' => true,
67+
'no_superfluous_elseif' => true,
68+
'no_spaces_after_function_name' => true,
69+
'no_spaces_around_offset' => true,
70+
'no_spaces_inside_parenthesis' => true,
71+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'allow_unused_params' => true],
72+
'no_trailing_comma_in_list_call' => true,
73+
'no_trailing_comma_in_singleline_array' => true,
74+
'no_trailing_whitespace' => true,
75+
'no_trailing_whitespace_in_comment' => true,
76+
'no_unneeded_control_parentheses' => true,
77+
'no_unneeded_curly_braces' => ['namespaces' => true],
78+
'no_unused_imports' => true,
79+
'no_useless_else' => true,
80+
'no_useless_return' => true,
81+
'no_whitespace_before_comma_in_array' => true,
82+
'no_whitespace_in_blank_line' => true,
83+
'normalize_index_brace' => true,
84+
'not_operator_with_space' => false,
85+
'object_operator_without_whitespace' => true,
86+
'ordered_class_elements' => true,
87+
'ordered_imports' => true,
88+
'php_unit_fqcn_annotation' => true,
89+
'phpdoc_align' => ['tags' => [
90+
'method',
91+
'param',
92+
'property',
93+
'return',
94+
'throws',
95+
'type',
96+
'var',
97+
]],
98+
'phpdoc_add_missing_param_annotation' => true,
99+
'phpdoc_annotation_without_dot' => true,
100+
'phpdoc_indent' => true,
101+
'phpdoc_inline_tag' => true,
102+
'phpdoc_no_access' => true,
103+
'phpdoc_no_alias_tag' => true,
104+
'phpdoc_no_package' => true,
105+
'phpdoc_no_useless_inheritdoc' => true,
106+
'phpdoc_order' => true,
107+
'phpdoc_return_self_reference' => true,
108+
'phpdoc_scalar' => true,
109+
'phpdoc_separation' => true,
110+
'phpdoc_single_line_var_spacing' => true,
111+
'phpdoc_summary' => true,
112+
'phpdoc_to_comment' => true,
113+
'phpdoc_trim' => true,
114+
'phpdoc_trim_consecutive_blank_line_separation' => true,
115+
'phpdoc_types' => true,
116+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
117+
'phpdoc_var_without_name' => true,
118+
'return_assignment' => true,
119+
'return_type_declaration' => true,
120+
'semicolon_after_instruction' => true,
121+
'simplified_null_return' => true,
122+
'short_scalar_cast' => true,
123+
'single_blank_line_at_eof' => true,
124+
'single_blank_line_before_namespace' => true,
125+
'single_class_element_per_statement' => true,
126+
'single_import_per_statement' => true,
127+
'single_line_after_imports' => true,
128+
'single_line_comment_style' => ['comment_types' => ['hash']],
129+
'single_line_throw' => true,
130+
'single_quote' => true,
131+
'single_trait_insert_per_statement' => true,
132+
'space_after_semicolon' => ['remove_in_empty_for_expressions'=>true],
133+
'standardize_increment' => true,
134+
'standardize_not_equals' => true,
135+
'switch_case_semicolon_to_colon' => true,
136+
'switch_case_space' => true,
137+
'ternary_operator_spaces' => true,
138+
'ternary_to_null_coalescing' => true,
139+
'trailing_comma_in_multiline_array' => true,
140+
'trim_array_spaces' => true,
141+
'unary_operator_spaces' => true,
142+
'visibility_required' => true,
143+
'whitespace_after_comma_in_array' => true,
144+
'yoda_style' => false,
145+
])
146+
->setFinder($finder)
147+
->setCacheFile(__DIR__.'/.php_cs.cache')
148+
;

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"require": {
1616
"php": ">=7.1",
1717
"ext-mbstring": "*",
18-
"paquettg/string-encode": "~1.0.0",
1918
"ext-zlib": "*",
2019
"ext-curl": "*",
20+
"paquettg/string-encode": "~1.0.0",
2121
"php-http/httplug": "^2.1",
2222
"php-http/guzzle6-adapter": "^2.0",
2323
"guzzlehttp/psr7": "^1.6"
@@ -27,7 +27,8 @@
2727
"mockery/mockery": "^1.2",
2828
"php-coveralls/php-coveralls": "^2.1",
2929
"infection/infection": "^0.13.4",
30-
"phan/phan": "^2.4"
30+
"phan/phan": "^2.4",
31+
"friendsofphp/php-cs-fixer": "^2.16"
3132
},
3233
"autoload": {
3334
"psr-4": {

0 commit comments

Comments
 (0)