diff --git a/composer.json b/composer.json index 4f88b90..4274307 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^7.4 || ^8.0", "ext-tokenizer": "*", - "friendsofphp/php-cs-fixer": "^3.30", + "friendsofphp/php-cs-fixer": "^3.34", "nexusphp/cs-config": "^3.6" }, "require-dev": { diff --git a/src/CodeIgniter4.php b/src/CodeIgniter4.php index d929c4b..7c56124 100644 --- a/src/CodeIgniter4.php +++ b/src/CodeIgniter4.php @@ -70,6 +70,15 @@ public function __construct() 'min_line_breaks' => 2, 'max_line_breaks' => 2, ], + 'braces_position' => [ + 'control_structures_opening_brace' => 'same_line', + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'anonymous_functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'anonymous_classes_opening_brace' => 'same_line', + 'allow_single_line_empty_anonymous_classes' => true, + 'allow_single_line_anonymous_functions' => true, + ], 'cast_spaces' => ['space' => 'single'], 'class_attributes_separation' => [ 'elements' => [ @@ -101,31 +110,22 @@ public function __construct() 'phpstan-ignore-next-line', ], ], - 'compact_nullable_typehint' => true, + 'compact_nullable_type_declaration' => true, 'concat_space' => ['spacing' => 'one'], 'constant_case' => ['case' => 'lower'], 'control_structure_braces' => true, 'control_structure_continuation_position' => ['position' => 'same_line'], - 'curly_braces_position' => [ - 'control_structures_opening_brace' => 'same_line', - 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', - 'anonymous_functions_opening_brace' => 'same_line', - 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', - 'anonymous_classes_opening_brace' => 'same_line', - 'allow_single_line_empty_anonymous_classes' => true, - 'allow_single_line_anonymous_functions' => true, - ], - 'date_time_create_from_format_call' => true, - 'date_time_immutable' => false, - 'declare_equal_normalize' => ['space' => 'none'], - 'declare_parentheses' => true, - 'declare_strict_types' => false, - 'dir_constant' => true, - 'doctrine_annotation_array_assignment' => false, - 'doctrine_annotation_braces' => false, - 'doctrine_annotation_indentation' => false, - 'doctrine_annotation_spaces' => false, - 'echo_tag_syntax' => [ + 'date_time_create_from_format_call' => true, + 'date_time_immutable' => false, + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'declare_strict_types' => false, + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => false, + 'doctrine_annotation_braces' => false, + 'doctrine_annotation_indentation' => false, + 'doctrine_annotation_spaces' => false, + 'echo_tag_syntax' => [ 'format' => 'short', 'long_function' => 'echo', 'shorten_simple_statements_only' => false, @@ -216,20 +216,21 @@ public function __construct() 'magic_method_casing' => true, 'mb_str_functions' => false, 'method_argument_space' => [ - 'after_heredoc' => false, 'keep_multiple_spaces_after_comma' => false, 'on_multiline' => 'ensure_fully_multiline', - ], - 'method_chaining_indentation' => true, - 'modernize_strpos' => false, // requires 8.0+ - 'modernize_types_casting' => true, - 'multiline_comment_opening_closing' => true, - 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], - 'native_constant_invocation' => false, - 'native_function_casing' => true, - 'native_function_invocation' => false, - 'native_function_type_declaration_casing' => true, - 'new_with_braces' => [ + 'after_heredoc' => false, + 'attribute_placement' => 'standalone', + ], + 'method_chaining_indentation' => true, + 'modernize_strpos' => false, // requires 8.0+ + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], + 'native_constant_invocation' => false, + 'native_function_casing' => true, + 'native_function_invocation' => false, + 'native_type_declaration_casing' => true, + 'new_with_parentheses' => [ 'named_class' => true, 'anonymous_class' => true, ], @@ -291,6 +292,7 @@ public function __construct() 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, 'no_trailing_whitespace_in_string' => true, + 'no_unneeded_braces' => ['namespaces' => true], 'no_unneeded_control_parentheses' => [ 'statements' => [ 'break', @@ -302,7 +304,6 @@ public function __construct() 'yield', ], ], - 'no_unneeded_curly_braces' => ['namespaces' => true], 'no_unneeded_final_method' => ['private_methods' => true], 'no_unneeded_import_alias' => true, 'no_unreachable_default_argument_value' => true,