Skip to content

Commit 23be858

Browse files
committed
Merge branch 'master' of github.com:Modix/php-cs-rulesets
# Conflicts: # composer.json
2 parents 58aa7df + 31c739a commit 23be858

File tree

3 files changed

+159
-23
lines changed

3 files changed

+159
-23
lines changed

Diff for: README.md

+1-16
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22

33
## Installation
44

5-
Add the repository to your `composer.json`
6-
7-
```json5
8-
{
9-
// ...
10-
"repositories": [
11-
{
12-
"type": "vcs",
13-
"url": "[email protected]:Modix/php-cs-rulesets.git"
14-
}
15-
],
16-
// ...
17-
}
18-
```
19-
205
Install the rulesets with composer
216

227
`composer require modix/php-cs-rulesets --dev`
@@ -44,7 +29,7 @@ $finder = PhpCsFixer\Finder::create()
4429

4530
$config = new PhpCsFixer\Config();
4631
$config
47-
->setRiskyAllowed(true)
32+
->setRiskyAllowed(false)
4833
->setRules($modixSet->getRules())
4934
->setFinder($finder)
5035
;

Diff for: composer.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
"email": "[email protected]"
99
}
1010
],
11-
"suggest": {
12-
"phpro/grumphp-shim": "To use pre commit hooks blabla"
13-
},
14-
"require-dev": {
15-
"friendsofphp/php-cs-fixer": "^2.18",
16-
"composer/composer": "^2.0"
11+
"require": {
12+
"friendsofphp/php-cs-fixer": "^2.18"
1713
},
1814
"autoload": {
1915
"psr-4": {

Diff for: src/RuleSet/Sets/ModixLegacySet.php

+156-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,162 @@ final class ModixLegacySet extends AbstractRuleSetDescription
99
public function getRules()
1010
{
1111
return [
12-
'@PSR2' => true,
12+
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.18/src/RuleSet/Sets/PSR1Set.php
13+
'@PSR1' => true,
14+
/**
15+
* @PSR2
16+
* @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.18/src/RuleSet/Sets/PSR2Set.php
17+
*/
18+
'blank_line_after_namespace' => true,
19+
'elseif' => true,
20+
'function_declaration' => true,
21+
'indentation_type' => true,
22+
'line_ending' => true,
23+
'lowercase_constants' => true,
24+
'lowercase_keywords' => true,
25+
'no_break_comment' => true,
26+
'no_closing_tag' => true,
27+
'no_spaces_after_function_name' => true,
28+
'no_spaces_inside_parenthesis' => true,
29+
'no_trailing_whitespace' => true,
30+
'no_trailing_whitespace_in_comment' => true,
31+
'single_blank_line_at_eof' => true,
32+
'single_class_element_per_statement' => ['elements' => ['property']],
33+
'single_import_per_statement' => true,
34+
'single_line_after_imports' => true,
35+
'switch_case_semicolon_to_colon' => true,
36+
'switch_case_space' => true,
37+
'visibility_required' => true,
38+
/**
39+
* @Symfony
40+
* @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.18/src/RuleSet/Sets/SymfonySet.php
41+
*/
42+
// 'binary_operator_spaces' => true,
43+
// 'blank_line_after_opening_tag' => true,
44+
// 'braces' => [
45+
// 'allow_single_line_closure' => true,
46+
// ],
47+
'cast_spaces' => true,
48+
'class_attributes_separation' => ['elements' => ['method']],
49+
'class_definition' => ['singleLine' => true],
50+
'declare_equal_normalize' => true,
51+
'function_typehint_space' => true,
52+
'include' => true,
53+
// 'increment_style' => true,
54+
'lowercase_cast' => true,
55+
// 'magic_constant_casing' => true,
56+
// 'method_argument_space' => true,
57+
// 'native_function_casing' => true,
58+
// 'new_with_braces' => true,
59+
// 'no_blank_lines_after_class_opening' => true,
60+
// 'no_blank_lines_after_phpdoc' => true,
61+
// 'no_empty_comment' => true,
62+
// 'no_empty_phpdoc' => true,
63+
// 'no_empty_statement' => true,
64+
// 'no_extra_blank_lines' => ['tokens' => [
65+
// 'curly_brace_block',
66+
// 'extra',
67+
// 'parenthesis_brace_block',
68+
// 'square_brace_block',
69+
// 'throw',
70+
// 'use',
71+
// ]],
72+
// 'no_leading_import_slash' => true,
73+
// 'no_leading_namespace_whitespace' => true,
74+
// 'no_mixed_echo_print' => ['use' => 'echo'],
75+
// 'no_multiline_whitespace_around_double_arrow' => true,
76+
// 'no_short_bool_cast' => true,
77+
// 'no_singleline_whitespace_before_semicolons' => true,
78+
// 'no_spaces_around_offset' => true,
79+
// 'no_trailing_comma_in_list_call' => true,
80+
// 'no_trailing_comma_in_singleline_array' => true,
81+
// 'no_unneeded_control_parentheses' => true,
82+
// 'no_unneeded_curly_braces' => true,
83+
// 'no_unneeded_final_method' => true,
84+
// 'no_unused_imports' => true,
85+
// 'no_whitespace_before_comma_in_array' => true,
86+
// 'no_whitespace_in_blank_line' => true,
87+
// 'normalize_index_brace' => true,
88+
// 'object_operator_without_whitespace' => true,
89+
// 'php_unit_fqcn_annotation' => true,
90+
// 'phpdoc_align' => [
91+
// // @TODO: on 3.0 switch whole rule to `=> true`, currently we use custom config that will be default on 3.0
92+
// 'tags' => [
93+
// 'method',
94+
// 'param',
95+
// 'property',
96+
// 'return',
97+
// 'throws',
98+
// 'type',
99+
// 'var',
100+
// ],
101+
// ],
102+
// 'phpdoc_annotation_without_dot' => true,
103+
// 'phpdoc_indent' => true,
104+
// 'phpdoc_inline_tag' => true,
105+
// 'phpdoc_no_access' => true,
106+
// 'phpdoc_no_alias_tag' => true,
107+
// 'phpdoc_no_empty_return' => true,
108+
// 'phpdoc_no_package' => true,
109+
// 'phpdoc_no_useless_inheritdoc' => true,
110+
// 'phpdoc_return_self_reference' => true,
111+
// 'phpdoc_scalar' => true,
112+
// 'phpdoc_separation' => true,
113+
// 'phpdoc_single_line_var_spacing' => true,
114+
// 'phpdoc_to_comment' => true,
115+
// 'phpdoc_trim' => true,
116+
// 'phpdoc_types' => true,
117+
// 'phpdoc_var_without_name' => true,
118+
// 'protected_to_private' => true,
119+
// 'return_type_declaration' => true,
120+
// 'semicolon_after_instruction' => true,
121+
// 'short_scalar_cast' => true,
122+
// 'single_blank_line_before_namespace' => true,
123+
// 'single_class_element_per_statement' => true,
124+
// 'single_line_comment_style' => [
125+
// 'comment_types' => ['hash'],
126+
// ],
127+
// 'single_quote' => true,
128+
// 'space_after_semicolon' => [
129+
// 'remove_in_empty_for_expressions' => true,
130+
// ],
131+
// 'standardize_increment' => true,
132+
// 'standardize_not_equals' => true,
133+
// 'ternary_operator_spaces' => true,
134+
// 'trailing_comma_in_multiline_array' => true,
135+
// 'trim_array_spaces' => true,
136+
// 'unary_operator_spaces' => true,
137+
// 'whitespace_after_comma_in_array' => true,
138+
/**
139+
* Modix specific changes to inherited rules (e.g. from @Symfony)
140+
*/
141+
// 'blank_line_before_statement' => [
142+
// 'statements' => ['return', 'yield'],
143+
// ],
144+
// 'concat_space' => ['spacing' => 'one'],
145+
// 'phpdoc_summary' => false,
146+
// 'yoda_style' => false,
147+
/**
148+
* Modix custom rules that are not set by any inherited rule
149+
*/
150+
// 'array_syntax' => ['syntax' => 'short'],
151+
// 'backtick_to_shell_exec' => true,
152+
// 'combine_consecutive_issets' => true,
153+
// 'explicit_string_variable' => true,
154+
// 'general_phpdoc_annotation_remove' => ['annotations' => [
155+
// 'author',
156+
// 'throws'
157+
// ]],
158+
// 'linebreak_after_opening_tag' => true,
159+
// 'method_chaining_indentation' => true,
160+
// 'no_null_property_initialization' => true,
161+
// 'no_short_echo_tag' => true,
162+
// 'no_superfluous_elseif' => true,
163+
// 'no_useless_else' => true,
164+
// 'no_useless_return' => true,
165+
// 'ordered_imports' => true,
166+
// 'phpdoc_order' => true,
167+
// 'phpdoc_types_order' => true,
13168
];
14169
}
15170

0 commit comments

Comments
 (0)