From da52f495b4c82019e5c09876f22cd45809a5da7d Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 12 Sep 2022 14:09:01 +0200 Subject: [PATCH] chore(legacy): set format rules based on version --- legacy/.php-cs-fixer.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/legacy/.php-cs-fixer.php b/legacy/.php-cs-fixer.php index 1e1134f66..d141a4c30 100644 --- a/legacy/.php-cs-fixer.php +++ b/legacy/.php-cs-fixer.php @@ -6,12 +6,24 @@ $finder = PhpCsFixer\Finder::create() ->exclude('application/models/airtime/map') ->exclude('application/models/airtime/om'); + +$extra_rules = [ + 'phpdoc_order' => false, +]; + +if (version_compare(PhpCsFixer\Console\Application::VERSION, '3.11.0') >= 0) { + $extra_rules['phpdoc_order'] = ['order' => ['param', 'return', 'throws']]; +} + $config = new PhpCsFixer\Config(); -return $config->setRules([ - '@PhpCsFixer' => true, - 'concat_space' => ['spacing' => 'one'], - 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], - 'ordered_class_elements' => false, - 'yoda_style' => false, -]) +return $config->setRules(array_merge( + [ + '@PhpCsFixer' => true, + 'concat_space' => ['spacing' => 'one'], + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], + 'ordered_class_elements' => false, + 'yoda_style' => false, + ], + $extra_rules +)) ->setFinder($finder);