From 200301e853012d25355780f44b901d3228e77cbf Mon Sep 17 00:00:00 2001 From: Divyajose <75604843+divya-intelli@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:53:01 +0530 Subject: [PATCH] Upgraded friendsofphp/php-cs-fixer to ^3.22 (#290) --- .gitignore | 2 +- .php_cs.dist => .php-cs-fixer.dist.php | 14 ++++++++++---- composer.json | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-) rename .php_cs.dist => .php-cs-fixer.dist.php (77%) diff --git a/.gitignore b/.gitignore index 4fadd2dd..2129f5a5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ /*.php /*.xml /*.log -!/.php_cs.dist +!/.php-cs-fixer.dist.php !/psalm.xml.dist !/phpunit.xml.dist /vendor diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 77% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index e5e05859..393f4686 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -11,21 +11,25 @@ * added to the repo. * @todo: Add a copyright validation (https://github.com/apigee/apigee-client-php/issues/81). */ -return PhpCsFixer\Config::create() +$config = new PhpCsFixer\Config(); + +$config ->setRiskyAllowed(true) ->setRules([ '@PSR2' => true, '@Symfony' => true, 'array_syntax' => ['syntax' => 'short'], - 'class_definition' => ['singleLine' => false, 'singleItemSingleLine' => true], + 'class_definition' => ['single_line' => false, 'single_item_single_line' => true], 'concat_space' => ['spacing' => 'one'], - 'general_phpdoc_annotation_remove' => ['author'], + 'general_phpdoc_annotation_remove' => ['annotations' => ['author']], 'ordered_class_elements' => true, 'ordered_imports' => true, 'phpdoc_align' => false, 'phpdoc_annotation_without_dot' => false, 'phpdoc_indent' => false, - 'phpdoc_inline_tag' => false, + 'general_phpdoc_tag_rename' => false, + 'phpdoc_inline_tag_normalizer' => false, + 'phpdoc_tag_type' => false, 'phpdoc_order' => true, // Disabled because fluent setters return type in an interface can not be self. 'self_accessor' => false, @@ -36,3 +40,5 @@ 'single_line_throw' => false, ]) ->setFinder($finder); + +return $config; diff --git a/composer.json b/composer.json index ca777782..6d4304c2 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ }, "require-dev": { "dms/phpunit-arraysubset-asserts": "^0.4.0", - "friendsofphp/php-cs-fixer": "^2.19", + "friendsofphp/php-cs-fixer": "^3.22", "fzaninotto/faker": "^1.7", "guzzlehttp/psr7": "^2.5", "league/flysystem": "^1.0", @@ -78,8 +78,8 @@ "analyze": "vendor/vimeo/psalm/psalm --config=psalm.xml.dist --show-info=false --stats", "metrics": "vendor/bin/phpmetrics .", "metrics-html": "vendor/bin/phpmetrics . --report-html=report", - "check-style": "vendor/bin/php-cs-fixer fix --config=./.php_cs.dist --verbose --dry-run", - "fix-style": "vendor/bin/php-cs-fixer fix --config=./.php_cs.dist" + "check-style": "vendor/bin/php-cs-fixer fix --config=./.php-cs-fixer.dist.php --verbose --dry-run", + "fix-style": "vendor/bin/php-cs-fixer fix --config=./.php-cs-fixer.dist.php" }, "extra": { "branch-alias": {