diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 650f766b..0754b09e 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,70 +6,77 @@ declare(strict_types=1); * @since 2.7.0 */ +$rules = [ + '@PSR12' => true, + '@Symfony' => true, + '@PhpCsFixer' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'list_syntax' => [ + 'syntax' => 'short', + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + 'blank_line_before_statement' => [ + 'statements' => [ + 'declare', + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', + 'function', + 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'single_line_comment_style' => [ + 'comment_types' => [ + ], + ], + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'constant_case' => [ + 'case' => 'lower', + ], + 'class_attributes_separation' => true, + 'combine_consecutive_unsets' => true, + 'declare_strict_types' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_static_reference' => true, + 'no_useless_else' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => false, + 'not_operator_with_space' => false, + 'ordered_class_elements' => true, + 'php_unit_strict' => false, + 'phpdoc_separation' => false, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'multiline_comment_opening_closing' => true, + 'phpdoc_summary' => false, + 'php_unit_test_class_requires_covers' => false, + 'global_namespace_import' => false, + 'phpdoc_order' => false, +]; + +if (PHP_VERSION_ID > 70400) { + $rules['no_useless_concat_operator'] = false; +} + +// 'no_useless_concat_operator' => false, + return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) - ->setRules([ - '@PSR12' => true, - '@Symfony' => true, - '@PhpCsFixer' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'list_syntax' => [ - 'syntax' => 'short', - ], - 'concat_space' => [ - 'spacing' => 'one', - ], - 'blank_line_before_statement' => [ - 'statements' => [ - 'declare', - ], - ], - 'ordered_imports' => [ - 'imports_order' => [ - 'class', - 'function', - 'const', - ], - 'sort_algorithm' => 'alpha', - ], - 'single_line_comment_style' => [ - 'comment_types' => [ - ], - ], - 'yoda_style' => [ - 'always_move_variable' => false, - 'equal' => false, - 'identical' => false, - ], - 'multiline_whitespace_before_semicolons' => [ - 'strategy' => 'no_multi_line', - ], - 'constant_case' => [ - 'case' => 'lower', - ], - 'class_attributes_separation' => true, - 'combine_consecutive_unsets' => true, - 'declare_strict_types' => true, - 'linebreak_after_opening_tag' => true, - 'lowercase_static_reference' => true, - 'no_useless_else' => true, - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => false, - 'not_operator_with_space' => false, - 'ordered_class_elements' => true, - 'php_unit_strict' => false, - 'phpdoc_separation' => false, - 'single_quote' => true, - 'standardize_not_equals' => true, - 'multiline_comment_opening_closing' => true, - 'phpdoc_summary' => false, - 'php_unit_test_class_requires_covers' => false, - 'global_namespace_import' => false, - 'phpdoc_order' => false, - 'no_useless_concat_operator' => false, - ]) + ->setRules($rules) ->setFinder( PhpCsFixer\Finder::create() ->in(__DIR__ . '/src')