From 284b4de04949b886bbe51bb037e33fe3e00ef21b Mon Sep 17 00:00:00 2001 From: Christoph Van Hees Date: Fri, 21 Jan 2022 11:22:24 +0100 Subject: [PATCH] Update and rename .php_cs to .php-cs-fixer.php Fix config for cs-fixer v3 and above --- dotfiles/.php-cs-fixer.php | 38 ++++++++++++++++++++++++++++++++++++++ dotfiles/.php_cs | 34 ---------------------------------- 2 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 dotfiles/.php-cs-fixer.php delete mode 100644 dotfiles/.php_cs diff --git a/dotfiles/.php-cs-fixer.php b/dotfiles/.php-cs-fixer.php new file mode 100644 index 0000000..aa11fb6 --- /dev/null +++ b/dotfiles/.php-cs-fixer.php @@ -0,0 +1,38 @@ +notPath('spark') + ->notPath('bootstrap') + ->notPath('storage') + ->notPath('vendor') + ->in(__DIR__) + ->name('*.php') + ->name('_ide_helper') + ->notName('*.blade.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sort_algorithm' => 'length'], + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'trailing_comma_in_multiline' => true, + 'phpdoc_scalar' => true, + 'unary_operator_spaces' => true, + 'binary_operator_spaces' => true, + 'blank_line_before_statement' => [ + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], + ], + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_var_without_name' => true, + 'method_argument_space' => [ + 'on_multiline' => 'ensure_fully_multiline', + 'keep_multiple_spaces_after_comma' => true, + ], + 'single_trait_insert_per_statement' => false, + ]) + ->setFinder($finder); diff --git a/dotfiles/.php_cs b/dotfiles/.php_cs deleted file mode 100644 index 9bb1020..0000000 --- a/dotfiles/.php_cs +++ /dev/null @@ -1,34 +0,0 @@ -setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - '@Symfony' => true, - '@Symfony:risky' => true, - 'array_syntax' => ['syntax' => 'short'], - 'combine_consecutive_unsets' => true, - 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'], - 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], - 'no_unreachable_default_argument_value' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_class_elements' => true, - 'ordered_imports' => ['sortAlgorithm' => 'length'], - 'php_unit_strict' => true, - 'php_unit_test_class_requires_covers' => true, - 'phpdoc_order' => true, - 'semicolon_after_instruction' => true, - 'single_trait_insert_per_statement' => false - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude([ - 'tests', - 'storage', - 'node_modules', - 'vendor', - ]) - ->in(__DIR__) - ) -;