Skip to content

Commit 714a38d

Browse files
committed
Bump minimal php-cs-fixer version to 2.13.0. Add additional rules.
1 parent 08483a2 commit 714a38d

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"type": "library",
1818
"require": {
1919
"php": "^7.0",
20-
"friendsofphp/php-cs-fixer": "^2.12.2"
20+
"friendsofphp/php-cs-fixer": "^2.13.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "^6.5.1"

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Rules.php

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Rules {
77

88
private static $rules = [
99
'@PSR2' => true,
10+
'array_indentation' => true,
1011
'array_syntax' => [
1112
'syntax' => 'short',
1213
],
@@ -20,41 +21,98 @@ class Rules {
2021
'class_attributes_separation' => [
2122
'elements' => ['method', 'property'],
2223
],
24+
'combine_consecutive_issets' => true,
25+
'combine_nested_dirname' => true,
2326
'compact_nullable_typehint' => true,
2427
'concat_space' => [
2528
'spacing' => 'one',
2629
],
2730
'declare_equal_normalize' => true,
31+
'dir_constant' => true,
32+
'ereg_to_preg' => true,
33+
'explicit_indirect_variable' => true,
34+
'explicit_string_variable' => true, // Should be configurable to choose between ${var} and {$var}
2835
'function_declaration' => [
2936
'closure_function_spacing' => 'none',
3037
],
3138
'function_to_constant' => true,
39+
'implode_call' => true,
3240
'include' => true,
41+
'is_null' => true,
3342
'linebreak_after_opening_tag' => true,
43+
'list_syntax' => [
44+
'syntax' => 'short',
45+
],
46+
'logical_operators' => true,
47+
'lowercase_cast' => true,
48+
'lowercase_static_reference' => true,
49+
'magic_constant_casing' => true,
50+
'magic_method_casing' => true,
3451
'method_chaining_indentation' => true,
3552
'modernize_types_casting' => true,
53+
'multiline_whitespace_before_semicolons' => [
54+
'strategy' => 'no_multi_line',
55+
],
56+
'native_function_casing' => true,
57+
'no_alternative_syntax' => true,
58+
'no_homoglyph_names' => true,
59+
'no_leading_import_slash' => true,
60+
'no_leading_namespace_whitespace' => true,
61+
'no_mixed_echo_print' => true,
62+
'no_multiline_whitespace_around_double_arrow' => true,
63+
'no_php4_constructor' => true,
3664
'no_short_bool_cast' => true,
65+
'no_spaces_around_offset' => true,
66+
'no_superfluous_elseif' => true,
3767
'no_trailing_comma_in_singleline_array' => true,
68+
'no_unneeded_control_parentheses' => true,
3869
'no_unneeded_final_method' => true,
3970
'no_unused_imports' => true,
4071
'no_useless_else' => true,
72+
'no_useless_return' => true,
4173
'no_whitespace_before_comma_in_array' => true,
4274
'no_whitespace_in_blank_line' => true,
4375
'non_printable_character' => [
4476
'use_escape_sequences_in_strings' => true,
4577
],
78+
'normalize_index_brace' => true,
4679
'object_operator_without_whitespace' => true,
4780
'ordered_class_elements' => true,
4881
'ordered_imports' => true,
49-
'random_api_migration' => true,
82+
'php_unit_construct' => true,
83+
'php_unit_expectation' => true,
84+
'php_unit_method_casing' => true,
85+
'php_unit_mock' => true,
86+
'php_unit_namespaced' => true,
87+
'php_unit_set_up_tear_down_visibility' => true,
88+
'php_unit_strict' => true,
89+
'pow_to_exponentiation' => true,
90+
'psr4' => true,
91+
'return_assignment' => true,
92+
'random_api_migration' => [
93+
'replacements' => [
94+
'getrandmax' => 'mt_getrandmax',
95+
'rand' => 'random_int',
96+
'srand' => 'mt_srand',
97+
],
98+
],
5099
'return_type_declaration' => [
51100
'space_before' => 'none',
52101
],
102+
'self_accessor' => true,
103+
'semicolon_after_instruction' => true,
104+
'set_type_to_cast' => true,
105+
'short_scalar_cast' => true,
53106
'single_quote' => true,
107+
'space_after_semicolon' => true,
108+
'standardize_increment' => true,
109+
'standardize_not_equals' => true,
54110
'strict_comparison' => true,
55111
'ternary_operator_spaces' => true,
56112
'ternary_to_null_coalescing' => true,
57113
'trailing_comma_in_multiline_array' => true,
114+
'trim_array_spaces' => true,
115+
'unary_operator_spaces' => true,
58116
'visibility_required' => [
59117
'elements' => ['property', 'method', 'const'],
60118
],

tests/Fixer/Whitespace/BlankLineBeforeReturnFixerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testFix($expected, $input = null) {
3636
public function provideFixCases() {
3737
$cases = [];
3838
$cases[] = [
39-
'$a = $a;
39+
'$a = $a;
4040
return $a;
4141
',
4242
];

0 commit comments

Comments
 (0)