From ebb8de67661db0c4a1a8a06f3912a1db0a19d504 Mon Sep 17 00:00:00 2001 From: brainshaker Date: Mon, 6 Mar 2023 20:49:57 +0100 Subject: [PATCH] chore(php-cs-fixer): configure php-cs-fixer for phpunit tests --- .php-cs-fixer.dist.php | 2 ++ composer-patches.json | 7 +++++++ composer.json | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 composer-patches.json diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e17ee26..9318675 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -16,6 +16,7 @@ '@PhpCsFixer:risky' => true, '@PHP80Migration:risky' => true, '@PHP81Migration' => true, + '@PHPUnit100Migration:risky' => true, 'binary_operator_spaces' => ['operators' => array_fill_keys(['=', '=>', '??=', '.=', '+=', '-=', '*=', '/=', '%=', '**=', '&=', '|=', '^=', '<<=', '>>='], 'align_single_space_minimal')], 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'do', 'exit', 'for', 'foreach', 'goto', 'if', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'while', 'yield', 'yield_from']], 'class_attributes_separation' => ['elements' => ['case' => 'none', 'method' => 'one', 'property' => 'one', 'trait_import' => 'none']], @@ -42,6 +43,7 @@ 'phpdoc_separation' => ['groups' => [['deprecated', 'link', 'see', 'since'], ['author', 'copyright', 'license'], ['category', 'package', 'subpackage'], ['property', 'phpstan-property', 'property-read', 'phpstan-property-read', 'property-write', 'phpstan-property-write'], ['param', 'phpstan-param'], ['return', 'phpstan-return']]], 'phpdoc_to_comment' => false, 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'php_unit_internal_class' => ['types' => ['abstract', 'final', 'normal']], 'psr_autoloading' => ['dir' => './src'], 'regular_callable_call' => true, 'self_static_accessor' => true, diff --git a/composer-patches.json b/composer-patches.json new file mode 100644 index 0000000..e1eb84a --- /dev/null +++ b/composer-patches.json @@ -0,0 +1,7 @@ +{ + "patches": { + "friendsofphp/php-cs-fixer": { + "Ignore rules for specific classes": "https://patch-diff.githubusercontent.com/raw/PHP-CS-Fixer/PHP-CS-Fixer/pull/6358.diff" + } + } +} diff --git a/composer.json b/composer.json index 65c6712..080e905 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "symplify/phpstan-rules": "11.2.4.72", "phpunit/phpunit": "10.0.11", "symfony/framework-bundle": "6.2.5", - "symfony/yaml": "6.2.5" + "symfony/yaml": "6.2.5", + "cweagans/composer-patches": "1.7.3" }, "require": { "php": ">=8.1", @@ -52,5 +53,8 @@ "psr-4": { "App\\Tests\\": "tests/" } + }, + "extra": { + "patches-file": "composer-patches.json" } }