From: Tim Düsterhus Date: Wed, 9 Jun 2021 10:19:52 +0000 (+0200) Subject: Upgrade to PHP-CS-Fixer 3 X-Git-Tag: 5.5.0_Alpha_1~64 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b01a3622e6ce2b9703e2e3317c91b17a83a82a29;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Upgrade to PHP-CS-Fixer 3 see WoltLab/WCF#4183 --- diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index d1d83e6..e63fd83 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -22,9 +22,9 @@ jobs: with: php-version: '7.4' extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib - tools: php-cs-fixer:2.19.0 + tools: php-cs-fixer - name: php-cs-fixer - run: php-cs-fixer fix --dry-run --diff-format udiff + run: php-cs-fixer fix --dry-run --diff ts: name: TS Prettier runs-on: ubuntu-latest diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..312569b --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,120 @@ +exclude('*/vendor/*') + ->in(__DIR__.'/files/'); + +return (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@PSR1' => true, + '@PSR2' => true, + + 'array_push' => true, + 'backtick_to_shell_exec' => true, + 'no_alias_language_construct_call' => true, + 'no_mixed_echo_print' => true, + 'pow_to_exponentiation' => true, + 'random_api_migration' => true, + + 'array_syntax' => ['syntax' => 'short'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_whitespace_before_comma_in_array' => true, + 'normalize_index_brace' => true, + 'whitespace_after_comma_in_array' => true, + + 'non_printable_character' => ['use_escape_sequences_in_strings' => true], + + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'native_function_casing' => true, + 'native_function_type_declaration_casing' => true, + + 'cast_spaces' => ['space' => 'none'], + 'lowercase_cast' => true, + 'no_unset_cast' => true, + 'short_scalar_cast' => true, + + 'class_attributes_separation' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_null_property_initialization' => true, + 'self_accessor' => true, + 'single_class_element_per_statement' => true, + 'single_trait_insert_per_statement' => true, + + 'no_empty_comment' => true, + 'single_line_comment_style' => ['comment_types' => ['hash']], + + 'native_constant_invocation' => ['strict' => false], + + 'no_alternative_syntax' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']], + 'no_unneeded_curly_braces' => ['namespaces' => true], + 'switch_continue_to_break' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + + 'function_typehint_space' => true, + 'lambda_not_used_import' => true, + 'native_function_invocation' => ['include' => ['@internal']], + 'no_unreachable_default_argument_value' => true, + 'nullable_type_declaration_for_default_null_value' => true, + 'return_type_declaration' => true, + 'static_lambda' => true, + + 'fully_qualified_strict_types' => true, + 'no_leading_import_slash' => true, + 'no_unused_imports' => true, + 'ordered_imports' => true, + + 'declare_equal_normalize' => true, + 'dir_constant' => true, + 'explicit_indirect_variable' => true, + 'function_to_constant' => true, + 'is_null' => true, + 'no_unset_on_property' => true, + + 'list_syntax' => ['syntax' => 'short'], + + 'clean_namespace' => true, + 'no_leading_namespace_whitespace' => true, + 'single_blank_line_before_namespace' => true, + + 'no_homoglyph_names' => true, + + 'binary_operator_spaces' => true, + 'concat_space' => ['spacing' => 'one'], + 'increment_style' => ['style' => 'post'], + 'logical_operators' => true, + 'object_operator_without_whitespace' => true, + 'operator_linebreak' => true, + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_elvis_operator' => true, + 'ternary_to_null_coalescing' => true, + 'unary_operator_spaces' => true, + + 'no_useless_return' => true, + 'return_assignment' => true, + + 'multiline_whitespace_before_semicolons' => true, + 'no_empty_statement' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], + + 'escape_implicit_backslashes' => true, + 'explicit_string_variable' => true, + 'heredoc_to_nowdoc' => true, + 'no_binary_string' => true, + 'simple_to_complex_string_variable' => true, + + 'array_indentation' => true, + 'blank_line_before_statement' => ['statements' => ['return', 'exit']], + 'compact_nullable_typehint' => true, + 'method_chaining_indentation' => true, + 'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']], + 'no_spaces_around_offset' => true, + ]) + ->setFinder($finder); diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index 9754205..0000000 --- a/.php_cs.dist +++ /dev/null @@ -1,120 +0,0 @@ -exclude('*/vendor/*') - ->in(__DIR__.'/files/'); - -return (new PhpCsFixer\Config()) - ->setRiskyAllowed(true) - ->setRules([ - '@PSR1' => true, - '@PSR2' => true, - - 'array_push' => true, - 'backtick_to_shell_exec' => true, - 'no_alias_language_construct_call' => true, - 'no_mixed_echo_print' => true, - 'pow_to_exponentiation' => true, - 'random_api_migration' => true, - - 'array_syntax' => ['syntax' => 'short'], - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_whitespace_before_comma_in_array' => true, - 'normalize_index_brace' => true, - 'trailing_comma_in_multiline_array' => true, - 'whitespace_after_comma_in_array' => true, - - 'non_printable_character' => ['use_escape_sequences_in_strings' => true], - - 'lowercase_static_reference' => true, - 'magic_constant_casing' => true, - 'magic_method_casing' => true, - 'native_function_casing' => true, - 'native_function_type_declaration_casing' => true, - - 'cast_spaces' => ['space' => 'none'], - 'lowercase_cast' => true, - 'no_unset_cast' => true, - 'short_scalar_cast' => true, - - 'class_attributes_separation' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_null_property_initialization' => true, - 'self_accessor' => true, - 'single_class_element_per_statement' => true, - 'single_trait_insert_per_statement' => true, - - 'no_empty_comment' => true, - 'single_line_comment_style' => ['comment_types' => ['hash']], - - 'native_constant_invocation' => true, - - 'no_alternative_syntax' => true, - 'no_trailing_comma_in_list_call' => true, - 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']], - 'no_unneeded_curly_braces' => ['namespaces' => true], - 'switch_continue_to_break' => true, - - 'function_typehint_space' => true, - 'lambda_not_used_import' => true, - 'native_function_invocation' => true, - 'no_unreachable_default_argument_value' => true, - 'nullable_type_declaration_for_default_null_value' => true, - 'return_type_declaration' => true, - 'static_lambda' => true, - - 'fully_qualified_strict_types' => true, - 'no_leading_import_slash' => true, - 'no_unused_imports' => true, - 'ordered_imports' => true, - - 'declare_equal_normalize' => true, - 'dir_constant' => true, - 'explicit_indirect_variable' => true, - 'function_to_constant' => true, - 'is_null' => true, - 'no_unset_on_property' => true, - - 'list_syntax' => ['syntax' => 'short'], - - 'clean_namespace' => true, - 'no_leading_namespace_whitespace' => true, - 'single_blank_line_before_namespace' => true, - - 'no_homoglyph_names' => true, - - 'binary_operator_spaces' => true, - 'concat_space' => ['spacing' => 'one'], - 'increment_style' => ['style' => 'post'], - 'logical_operators' => true, - 'object_operator_without_whitespace' => true, - 'operator_linebreak' => true, - 'standardize_increment' => true, - 'standardize_not_equals' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_elvis_operator' => true, - 'ternary_to_null_coalescing' => true, - 'unary_operator_spaces' => true, - - 'no_useless_return' => true, - 'return_assignment' => true, - - 'multiline_whitespace_before_semicolons' => true, - 'no_empty_statement' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], - - 'escape_implicit_backslashes' => true, - 'explicit_string_variable' => true, - 'heredoc_to_nowdoc' => true, - 'no_binary_string' => true, - 'simple_to_complex_string_variable' => true, - - 'array_indentation' => true, - 'blank_line_before_statement' => ['statements' => ['return', 'exit']], - 'compact_nullable_typehint' => true, - 'method_chaining_indentation' => true, - 'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']], - 'no_spaces_around_offset' => true, - ]) - ->setFinder($finder);