From a0522c67ade798e537b43e222187c8f7789de5b4 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Fri, 12 Nov 2021 20:11:07 -0500 Subject: [PATCH] Update php-cs-fixer --- .gitignore | 2 +- .php_cs => .php-cs-fixer.php | 24 ++++++++++++------------ CHANGELOG.md | 3 +++ composer.json | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) rename .php_cs => .php-cs-fixer.php (86%) diff --git a/.gitignore b/.gitignore index f4aaccde..19d76869 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # Code stuff vendor composer.lock -.php_cs.cache +.php-cs-fixer.cache _meta .phpunit.result.cache diff --git a/.php_cs b/.php-cs-fixer.php similarity index 86% rename from .php_cs rename to .php-cs-fixer.php index 2fbcfe8e..48f3b850 100644 --- a/.php_cs +++ b/.php-cs-fixer.php @@ -9,10 +9,10 @@ $rules = [ '@PSR2' => true, 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => false], + 'binary_operator_spaces' => ['operators' => ['=>' => 'align', '=' => 'single_space']], 'blank_line_after_namespace' => true, 'blank_line_after_opening_tag' => true, - 'blank_line_before_return' => true, + 'blank_line_before_statement' => ['statements' => ['return']], 'braces' => true, 'cast_spaces' => true, 'class_definition' => true, @@ -22,16 +22,15 @@ 'full_opening_tag' => true, 'function_declaration' => true, 'function_typehint_space' => true, - 'hash_to_slash_comment' => true, + 'single_line_comment_style' => ['comment_types' => ['hash']], 'heredoc_to_nowdoc' => true, 'include' => true, 'indentation_type' => true, 'line_ending' => true, 'lowercase_cast' => true, - 'lowercase_constants' => true, + 'constant_case' => ['case' => 'lower'], 'lowercase_keywords' => true, 'method_argument_space' => true, - 'method_separation' => true, 'multiline_whitespace_before_semicolons' => true, 'native_function_casing' => true, 'new_with_braces' => true, @@ -63,19 +62,21 @@ 'no_whitespace_in_blank_line' => true, 'normalize_index_brace' => true, 'object_operator_without_whitespace' => true, + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 'phpdoc_align' => true, 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, + 'general_phpdoc_tag_rename' => true, + 'phpdoc_inline_tag_normalizer' => true, + 'phpdoc_tag_type' => ['tags' => ['inheritdoc' => 'inline']], 'phpdoc_no_empty_return' => true, 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => ['type' => 'var'], 'phpdoc_no_package' => true, 'phpdoc_order' => true, 'phpdoc_scalar' => true, 'phpdoc_single_line_var_spacing' => true, 'phpdoc_trim' => true, 'phpdoc_types' => true, - 'psr4' => true, + 'psr_autoloading' => true, 'short_scalar_cast' => true, 'simplified_null_return' => true, 'single_blank_line_at_eof' => true, @@ -102,9 +103,8 @@ $finder = PhpCsFixer\Finder::create() ->in([__DIR__ . '/src', __DIR__ . '/tests']); -return PhpCsFixer\Config::create() - ->setRules($rules) +$config = new PhpCsFixer\Config(); +return $config->setRules($rules) ->setFinder($finder) ->setUsingCache(true) - ->setCacheFile(__DIR__.'/.php_cs.cache') - ->setRiskyAllowed(true); + ->setRiskyAllowed(true); \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d0bebb94..ab235e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 4.6.1 + - Update php-cs-fixer to V3 + ## 4.6.0 - Drop PHP 7.2 and add PHP 8.0 support. - Upgrade all Laravel packages to ^8.x from ^5.8. diff --git a/composer.json b/composer.json index ddae9e1a..bbbf2c9d 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "twig/twig": "^2.11" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.13", + "friendsofphp/php-cs-fixer": "^3.0", "phpunit/phpunit": "^9.5", "slim/slim": "^3", "mockery/mockery": "^1.2",