Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update codestyle rules #89

Merged
merged 1 commit into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions .editorconfig
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions rules/main.php
Expand Up @@ -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,
Expand Down Expand Up @@ -118,7 +121,7 @@
],

'control_structure_continuation_position' => [
'position' => 'same_line',
'position' => 'next_line',
],

'empty_loop_body' => [
Expand Down Expand Up @@ -500,4 +503,6 @@
'types_spaces' => [
'space' => 'none',
],

'control_structure_braces' => true,
];
3 changes: 2 additions & 1 deletion src/Processors/CodeStyler.php
Expand Up @@ -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;
}
Expand Down