Skip to content

Commit d719211

Browse files
authored
Merge pull request #18 from dnetix/upgrade
Reformat code
2 parents 5105ee7 + 9a600d2 commit d719211

Some content is hidden

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

42 files changed

+1757
-380
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
.project
33
vendor
44
tests/coverage
5+
.DS_Store
6+
.phpunit.result.cache

.php_cs

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

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
"php": ">=7.0",
1414
"ext-soap": "*",
1515
"ext-json": "*",
16-
"guzzlehttp/guzzle": ">=5.3"
16+
"guzzlehttp/guzzle": "^6.5"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^7.4",
19+
"friendsofphp/php-cs-fixer": "^2.16",
20+
"phpunit/phpunit": "^8.5",
2021
"squizlabs/php_codesniffer": "3.*",
2122
"symfony/var-dumper": "^4.3"
2223
},
@@ -31,6 +32,6 @@
3132
}
3233
},
3334
"scripts": {
34-
"phpcs": "phpcs --standard=PSR2 --exclude=Generic.Files.LineLength --ignore=tests/coverage src/ tests/"
35+
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --config=.php_cs"
3536
}
3637
}

0 commit comments

Comments
 (0)