From 97534fb25e6582cec8ef9ed8d97d1c09f08e5379 Mon Sep 17 00:00:00 2001 From: Sacha Telgenhof Date: Wed, 31 Jan 2024 01:06:31 +0900 Subject: [PATCH] build: Use shared PHP CS Fixer config Signed-off-by: Sacha Telgenhof --- .php-cs-fixer.php | 25 ++----------------------- composer.json | 6 ++++-- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 91d0df704..b84347c26 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -12,29 +12,8 @@ * * @author Sacha Telgenhof */ -$finder = PhpCsFixer\Finder::create()->in(__DIR__); -$config = new PhpCsFixer\Config(); -$config->setRiskyAllowed(true)->setRules([ - '@PER' => true, - '@Symfony' => true, - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'explicit_string_variable' => true, - 'no_superfluous_elseif' => true, - 'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true], - 'not_operator_with_successor_space' => true, - 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true ], - 'ordered_class_elements' => true, - - // Risky - 'declare_strict_types' => true, - 'dir_constant' => true, - 'get_class_to_class_keyword' => true, - 'is_null' => true, - 'modernize_strpos' => true, - 'modernize_types_casting' => true, - 'self_accessor' => true, -])->setFinder($finder); +$config = new AzuyaLabs\PhpCsFixerConfig\Config(); +$config->getFinder()->in(__DIR__)->notPath('var'); return $config; diff --git a/composer.json b/composer.json index e1519b520..1b06f3622 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "azuyalabs/yasumi", - "description": "The easy PHP Library for calculating holidays.", + "description": "The easy PHP Library for calculating holidays", "license": "MIT", "type": "library", "keywords": [ @@ -40,6 +40,7 @@ }, "require-dev": { "ext-intl": "*", + "azuyalabs/php-cs-fixer-config": "^0.1", "friendsofphp/php-cs-fixer": "^2.19 || 3.48", "mikey179/vfsstream": "^1.6", "phan/phan": "^5.4", @@ -72,7 +73,8 @@ "@phpstan", "@psalm" ], - "format": "./vendor/bin/php-cs-fixer fix", + "cs": "vendor/bin/php-cs-fixer fix -v --diff --dry-run", + "cs-fix": "vendor/bin/php-cs-fixer fix -v", "phan": "vendor/bin/phan -C", "phpstan": "vendor/bin/phpstan analyse", "psalm": "vendor/bin/psalm --threads=2",