From 8776bb29f6eb1f45aecfc46aec18785872a5c4d5 Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Tue, 1 Jun 2021 11:00:15 -0400 Subject: [PATCH] update rules to v3 compliance --- .php-cs-fixer.dist.php | 2 +- src/Rulesets/LaravelShiftRuleset.php | 5 ++- src/Rulesets/PhpUnitRuleset.php | 52 ++++++++++++++-------------- src/Rulesets/SpatieRuleset.php | 6 ++-- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b88016e..fa95696 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,4 +8,4 @@ // optional: chain additiional custom Finder options: $finder = ComposerPackageFinder::create(__DIR__); -return SharedConfig::create($finder, new DefaultRuleset()); \ No newline at end of file +return SharedConfig::create($finder, new DefaultRuleset()); diff --git a/src/Rulesets/LaravelShiftRuleset.php b/src/Rulesets/LaravelShiftRuleset.php index 43c884a..3397984 100644 --- a/src/Rulesets/LaravelShiftRuleset.php +++ b/src/Rulesets/LaravelShiftRuleset.php @@ -35,7 +35,7 @@ public function rules(): array 'braces' => true, 'cast_spaces' => true, 'class_attributes_separation' => [ - 'elements' => ['method'], + 'elements' => ['method' => 'one'], ], 'class_definition' => true, 'concat_space' => [ @@ -102,7 +102,7 @@ public function rules(): array 'normalize_index_brace' => true, 'not_operator_with_successor_space' => true, 'object_operator_without_whitespace' => true, - 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 'phpdoc_indent' => true, //'phpdoc_inline_tag' => true, 'phpdoc_no_access' => true, @@ -115,7 +115,6 @@ public function rules(): array 'phpdoc_trim' => true, 'phpdoc_types' => true, 'phpdoc_var_without_name' => true, - 'psr4' => true, 'self_accessor' => true, 'short_scalar_cast' => true, 'simplified_null_return' => false, // disabled by Shift diff --git a/src/Rulesets/PhpUnitRuleset.php b/src/Rulesets/PhpUnitRuleset.php index 6b51618..a8e87b6 100644 --- a/src/Rulesets/PhpUnitRuleset.php +++ b/src/Rulesets/PhpUnitRuleset.php @@ -27,34 +27,32 @@ public function rules(): array ], ], 'blank_line_after_namespace' => true, - 'blank_line_before_statement' => [ - 'statements' => [ - 'break', - 'continue', - 'declare', - 'default', - 'die', - 'do', - 'exit', - 'for', - 'foreach', - 'goto', - 'if', - 'include', - 'include_once', - 'require', - 'require_once', - 'return', - 'switch', - 'throw', - 'try', - 'while', - 'yield', + 'blank_line_before_statement' => ['statements' => [ + 'break', + 'continue', + 'declare', + 'default', + 'do', + 'exit', + 'for', + 'foreach', + 'goto', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', ], ], 'braces' => true, 'cast_spaces' => true, - 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']], + 'class_attributes_separation' => ['elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one']], 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'compact_nullable_typehint' => true, @@ -89,7 +87,7 @@ public function rules(): array 'lowercase_static_reference' => true, 'magic_constant_casing' => true, 'magic_method_casing' => true, - 'method_argument_space' => ['ensure_fully_multiline' => true], +// 'on_multiline' => 'ensure_fully_multiline', 'modernize_types_casting' => true, 'multiline_comment_opening_closing' => true, 'multiline_whitespace_before_semicolons' => true, @@ -214,7 +212,9 @@ public function rules(): array 'standardize_not_equals' => true, 'strict_param' => true, 'ternary_to_null_coalescing' => true, - 'trailing_comma_in_multiline_array' => true, + 'trailing_comma_in_multiline' => [ + 'elements' => ['arrays'], + ], 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'visibility_required' => [ diff --git a/src/Rulesets/SpatieRuleset.php b/src/Rulesets/SpatieRuleset.php index b3eecb9..c9db7b2 100644 --- a/src/Rulesets/SpatieRuleset.php +++ b/src/Rulesets/SpatieRuleset.php @@ -24,7 +24,7 @@ public function rules(): array return array_merge([ '@PSR2' => true, 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 'no_unused_imports' => true, 'not_operator_with_successor_space' => true, 'trailing_comma_in_multiline' => [ @@ -39,9 +39,7 @@ public function rules(): array 'phpdoc_single_line_var_spacing' => true, 'phpdoc_var_without_name' => true, 'class_attributes_separation' => [ - 'elements' => [ - 'method', - ], + 'elements' => ['method' => 'one'], ], 'method_argument_space' => [ 'on_multiline' => 'ensure_fully_multiline',