Skip to content

Commit d3dfd1b

Browse files
committed
upg: bump php-cs-fix ver and cs rules
1 parent 3eab86a commit d3dfd1b

2 files changed

Lines changed: 86 additions & 33 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"require": {
1313
"php": "^7.4 || ^8.0",
1414
"ext-tokenizer": "*",
15-
"friendsofphp/php-cs-fixer": "^3.6",
16-
"nexusphp/cs-config": "^3.4"
15+
"friendsofphp/php-cs-fixer": "^3.14",
16+
"nexusphp/cs-config": "^3.6"
1717
},
1818
"require-dev": {
1919
"nexusphp/tachycardia": "^1.3",

src/Blitz.php

Lines changed: 84 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public function __construct()
6464
'yield_from',
6565
],
6666
],
67-
'braces' => [
67+
'blank_line_between_import_groups' => true,
68+
'braces' => [
6869
'allow_single_line_anonymous_class_with_empty_body' => true,
6970
'allow_single_line_closure' => true,
7071
'position_after_anonymous_constructs' => 'same',
@@ -85,6 +86,7 @@ public function __construct()
8586
'single_item_single_line' => true,
8687
'single_line' => true,
8788
'space_before_parenthesis' => true,
89+
'inline_constructor_arguments' => true,
8890
],
8991
'class_reference_name_casing' => true,
9092
'clean_namespace' => true,
@@ -104,17 +106,28 @@ public function __construct()
104106
'compact_nullable_typehint' => true,
105107
'concat_space' => ['spacing' => 'one'],
106108
'constant_case' => ['case' => 'lower'],
109+
'control_structure_braces' => true,
107110
'control_structure_continuation_position' => ['position' => 'same_line'],
108-
'date_time_immutable' => false,
109-
'declare_equal_normalize' => ['space' => 'none'],
110-
'declare_parentheses' => true,
111-
'declare_strict_types' => false,
112-
'dir_constant' => true,
113-
'doctrine_annotation_array_assignment' => false,
114-
'doctrine_annotation_braces' => false,
115-
'doctrine_annotation_indentation' => false,
116-
'doctrine_annotation_spaces' => false,
117-
'echo_tag_syntax' => [
111+
'curly_braces_position' => [
112+
'control_structures_opening_brace' => 'same_line',
113+
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
114+
'anonymous_functions_opening_brace' => 'same_line',
115+
'classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
116+
'anonymous_classes_opening_brace' => 'same_line',
117+
'allow_single_line_empty_anonymous_classes' => true,
118+
'allow_single_line_anonymous_functions' => true,
119+
],
120+
'date_time_create_from_format_call' => true,
121+
'date_time_immutable' => false,
122+
'declare_equal_normalize' => ['space' => 'none'],
123+
'declare_parentheses' => true,
124+
'declare_strict_types' => false,
125+
'dir_constant' => true,
126+
'doctrine_annotation_array_assignment' => false,
127+
'doctrine_annotation_braces' => false,
128+
'doctrine_annotation_indentation' => false,
129+
'doctrine_annotation_spaces' => false,
130+
'echo_tag_syntax' => [
118131
'format' => 'short',
119132
'long_function' => 'echo',
120133
'shorten_simple_statements_only' => false,
@@ -147,8 +160,12 @@ public function __construct()
147160
'fopen_flags' => ['b_mode' => true],
148161
'full_opening_tag' => true,
149162
'fully_qualified_strict_types' => true,
150-
'function_declaration' => ['closure_function_spacing' => 'one'],
151-
'function_to_constant' => [
163+
'function_declaration' => [
164+
'closure_function_spacing' => 'one',
165+
'closure_fn_spacing' => 'one',
166+
'trailing_comma_single_line' => false,
167+
],
168+
'function_to_constant' => [
152169
'functions' => [
153170
'get_called_class',
154171
'get_class',
@@ -165,6 +182,7 @@ public function __construct()
165182
'package',
166183
'subpackage',
167184
],
185+
'case_sensitive' => false,
168186
],
169187
'general_phpdoc_tag_rename' => [
170188
'case_sensitive' => false,
@@ -204,16 +222,19 @@ public function __construct()
204222
'keep_multiple_spaces_after_comma' => false,
205223
'on_multiline' => 'ensure_fully_multiline',
206224
],
207-
'method_chaining_indentation' => true,
208-
'modernize_strpos' => false, // requires 8.0+
209-
'modernize_types_casting' => true,
210-
'multiline_comment_opening_closing' => true,
211-
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
212-
'native_constant_invocation' => false,
213-
'native_function_casing' => true,
214-
'native_function_invocation' => false,
215-
'native_function_type_declaration_casing' => true,
216-
'new_with_braces' => true,
225+
'method_chaining_indentation' => true,
226+
'modernize_strpos' => false, // requires 8.0+
227+
'modernize_types_casting' => true,
228+
'multiline_comment_opening_closing' => true,
229+
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
230+
'native_constant_invocation' => false,
231+
'native_function_casing' => true,
232+
'native_function_invocation' => false,
233+
'native_function_type_declaration_casing' => true,
234+
'new_with_braces' => [
235+
'named_class' => true,
236+
'anonymous_class' => true,
237+
],
217238
'no_alias_functions' => ['sets' => ['@all']],
218239
'no_alias_language_construct_call' => true,
219240
'no_alternative_syntax' => ['fix_non_monolithic_code' => false],
@@ -232,6 +253,7 @@ public function __construct()
232253
'no_leading_namespace_whitespace' => true,
233254
'no_mixed_echo_print' => ['use' => 'echo'],
234255
'no_multiline_whitespace_around_double_arrow' => true,
256+
'no_multiple_statements_per_line' => true,
235257
'no_null_property_initialization' => true,
236258
'no_php4_constructor' => true,
237259
'no_short_bool_cast' => true,
@@ -246,7 +268,14 @@ public function __construct()
246268
'allow_unused_params' => true,
247269
'remove_inheritdoc' => false,
248270
],
249-
'no_trailing_comma_in_singleline' => true,
271+
'no_trailing_comma_in_singleline' => [
272+
'elements' => [
273+
'arguments',
274+
'array_destructuring',
275+
'array',
276+
'group_import',
277+
],
278+
],
250279
'no_trailing_whitespace' => true,
251280
'no_trailing_whitespace_in_comment' => true,
252281
'no_trailing_whitespace_in_string' => true,
@@ -268,7 +297,9 @@ public function __construct()
268297
'no_unset_cast' => true,
269298
'no_unset_on_property' => false,
270299
'no_unused_imports' => true,
300+
'no_useless_concat_operator' => ['juggle_simple_strings' => true],
271301
'no_useless_else' => true,
302+
'no_useless_nullsafe_operator' => true,
272303
'no_useless_return' => true,
273304
'no_useless_sprintf' => true,
274305
'no_whitespace_before_comma_in_array' => ['after_heredoc' => true],
@@ -304,6 +335,7 @@ public function __construct()
304335
'assertNotSame',
305336
],
306337
],
338+
'php_unit_data_provider_static' => false,
307339
'php_unit_dedicate_assert' => ['target' => 'newest'],
308340
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
309341
'php_unit_expectation' => ['target' => 'newest'],
@@ -378,8 +410,10 @@ public function __construct()
378410
'phpdoc_no_empty_return' => false,
379411
'phpdoc_no_package' => true,
380412
'phpdoc_no_useless_inheritdoc' => true,
381-
'phpdoc_order' => true,
382-
'phpdoc_order_by_value' => [
413+
'phpdoc_order' => [
414+
'order' => ['param', 'return', 'throws'],
415+
],
416+
'phpdoc_order_by_value' => [
383417
'annotations' => [
384418
'author',
385419
'covers',
@@ -417,7 +451,21 @@ public function __construct()
417451
'str',
418452
],
419453
],
420-
'phpdoc_separation' => true,
454+
'phpdoc_separation' => [
455+
'groups' => [
456+
['immutable', 'psalm-immutable'],
457+
['param', 'phpstan-param', 'psalm-param'],
458+
['phpstan-pure', 'psalm-pure'],
459+
['readonly', 'psalm-readonly'],
460+
['return', 'phpstan-return', 'psalm-return'],
461+
['runTestsInSeparateProcess', 'runInSeparateProcess', 'preserveGlobalState'],
462+
['template', 'phpstan-template', 'psalm-template'],
463+
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
464+
['phpstan-type', 'psalm-type'],
465+
['var', 'phpstan-var', 'psalm-var'],
466+
],
467+
'skip_unlisted_annotations' => true,
468+
],
421469
'phpdoc_single_line_var_spacing' => true,
422470
'phpdoc_summary' => false,
423471
'phpdoc_tag_casing' => ['tags' => ['inheritDoc']],
@@ -459,8 +507,9 @@ public function __construct()
459507
'single_blank_line_at_eof' => true,
460508
'single_blank_line_before_namespace' => true,
461509
'single_class_element_per_statement' => ['elements' => ['const', 'property']],
462-
'single_import_per_statement' => true,
510+
'single_import_per_statement' => ['group_to_single_imports' => true],
463511
'single_line_after_imports' => true,
512+
'single_line_comment_spacing' => true,
464513
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
465514
'single_line_throw' => false,
466515
'single_quote' => ['strings_containing_single_quote_chars' => false],
@@ -528,6 +577,7 @@ public function __construct()
528577
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
529578
'standardize_increment' => true,
530579
'standardize_not_equals' => true,
580+
'statement_indentation' => true,
531581
'static_lambda' => true,
532582
'strict_comparison' => true,
533583
'strict_param' => true,
@@ -543,13 +593,16 @@ public function __construct()
543593
'after_heredoc' => true,
544594
'elements' => ['arrays'],
545595
],
546-
'trim_array_spaces' => true,
547-
'types_spaces' => ['space' => 'none'],
596+
'trim_array_spaces' => true,
597+
'types_spaces' => [
598+
'space' => 'none',
599+
'space_multiple_catch' => 'none',
600+
],
548601
'unary_operator_spaces' => true,
549602
'use_arrow_functions' => true,
550603
'visibility_required' => ['elements' => ['const', 'method', 'property']],
551604
'void_return' => false, // changes method signature
552-
'whitespace_after_comma_in_array' => true,
605+
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
553606
'yoda_style' => [
554607
'equal' => false,
555608
'identical' => null,

0 commit comments

Comments
 (0)