From 179289f8ebd7d69a33c9946ab65054a4b1f9879e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 26 Aug 2022 23:18:35 +0300 Subject: [PATCH] Update codestyle rules --- .editorconfig | 14 +++++++------- rules/main.php | 9 +++++++-- src/Processors/CodeStyler.php | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.editorconfig b/.editorconfig index 1b8b893..de516c0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,7 +6,7 @@ indent_style = space insert_final_newline = true max_line_length = 180 tab_width = 4 -trim_trailing_whitespace = true +trim_trailing_whitespace = false ij_continuation_indent_size = 8 ij_formatter_off_tag = @formatter:off ij_formatter_on_tag = @formatter:on @@ -517,7 +517,7 @@ ij_php_align_multiline_ternary_operation = false ij_php_align_named_arguments = true ij_php_align_phpdoc_comments = false ij_php_align_phpdoc_param_names = false -ij_php_anonymous_brace_style = end_of_line +ij_php_anonymous_brace_style = next_line ij_php_api_weight = 28 ij_php_array_initializer_new_line_after_left_brace = true ij_php_array_initializer_right_brace_on_new_line = true @@ -546,7 +546,7 @@ ij_php_block_brace_style = end_of_line ij_php_call_parameters_new_line_after_left_paren = false ij_php_call_parameters_right_paren_on_new_line = false ij_php_call_parameters_wrap = on_every_item -ij_php_catch_on_new_line = false +ij_php_catch_on_new_line = true ij_php_category_weight = 28 ij_php_class_brace_style = next_line ij_php_comma_after_last_argument = false @@ -558,13 +558,13 @@ ij_php_copyright_weight = 4 ij_php_deprecated_weight = 0 ij_php_do_while_brace_force = always ij_php_else_if_style = combine -ij_php_else_on_new_line = false +ij_php_else_on_new_line = true ij_php_example_weight = 28 ij_php_extends_keyword_wrap = normal ij_php_extends_list_wrap = off ij_php_fields_default_visibility = protected ij_php_filesource_weight = 28 -ij_php_finally_on_new_line = false +ij_php_finally_on_new_line = true ij_php_for_brace_force = always ij_php_for_statement_new_line_after_left_paren = false ij_php_for_statement_right_paren_on_new_line = false @@ -575,7 +575,7 @@ ij_php_getters_setters_naming_style = camel_case ij_php_getters_setters_order_style = getters_first ij_php_global_weight = 28 ij_php_group_use_wrap = on_every_item -ij_php_if_brace_force = if_multiline +ij_php_if_brace_force = always ij_php_if_lparen_on_next_line = true ij_php_if_rparen_on_next_line = true ij_php_ignore_weight = 28 @@ -595,7 +595,7 @@ ij_php_keep_line_breaks = true ij_php_keep_rparen_and_lbrace_on_one_line = true ij_php_keep_simple_classes_in_one_line = true ij_php_keep_simple_methods_in_one_line = false -ij_php_lambda_brace_style = end_of_line +ij_php_lambda_brace_style = next_line ij_php_license_weight = 5 ij_php_line_comment_add_space = false ij_php_line_comment_at_first_column = false diff --git a/rules/main.php b/rules/main.php index 43c6b24..d96e8fa 100644 --- a/rules/main.php +++ b/rules/main.php @@ -40,8 +40,11 @@ 'whitespace_after_comma_in_array' => true, 'braces' => [ - 'allow_single_line_anonymous_class_with_empty_body' => true, + 'allow_single_line_anonymous_class_with_empty_body' => false, 'allow_single_line_closure' => true, + 'position_after_anonymous_constructs' => 'next', + 'position_after_functions_and_oop_constructs' => 'next', + 'position_after_control_structures' => 'same', ], 'class_reference_name_casing' => true, @@ -118,7 +121,7 @@ ], 'control_structure_continuation_position' => [ - 'position' => 'same_line', + 'position' => 'next_line', ], 'empty_loop_body' => [ @@ -500,4 +503,6 @@ 'types_spaces' => [ 'space' => 'none', ], + + 'control_structure_braces' => true, ]; diff --git a/src/Processors/CodeStyler.php b/src/Processors/CodeStyler.php index 43d4f7c..664ff1c 100644 --- a/src/Processors/CodeStyler.php +++ b/src/Processors/CodeStyler.php @@ -39,7 +39,8 @@ protected function getArgv(): ArgvInput protected function resolveOptions(): array { return Arr::of($this->getOptions()) - ->map(function ($value, string $key) { + ->map(function ($value, string $key) + { if (is_bool($value)) { return $key; }