Clean up rule set.

This commit is contained in:
James Cole
2024-02-20 19:59:55 +01:00
parent aa2afd162e
commit 8f14979717

View File

@@ -35,36 +35,39 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config(); $config = new PhpCsFixer\Config();
return $config->setRules([ return $config->setRules(
'no_unused_imports' => true, [
'@PhpCsFixer' => true, // rule sets
'@PHP83Migration' => true, '@PHP83Migration' => true,
'@PhpCsFixer:risky' => true, '@PhpCsFixer' => true,
'@PSR12:risky' => true, '@PhpCsFixer:risky' => true,
'declare_strict_types' => true, '@PSR12' => true,
'strict_param' => true, '@PSR12:risky' => true,
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm. 'declare_strict_types' => true,
'array_syntax' => ['syntax' => 'short'], 'strict_param' => true,
'native_function_invocation' => false, // annoying 'no_unused_imports' => true,
'php_unit_data_provider_name' => false, // bloody annoying long test names 'single_space_around_construct' => true,
'static_lambda' => false, // breaks the Response macro for API's. 'statement_indentation' => true,
'phpdoc_summary' => false, // annoying. 'void_return' => true,
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [ // disabled rules
'protected', 'native_function_invocation' => false, // annoying
], 'php_unit_data_provider_name' => false, // bloody annoying long test names
], 'static_lambda' => false, // breaks the Response macro for API's.
'statement_indentation' => true, 'phpdoc_summary' => false, // annoying.
'type_declaration_spaces' => false, 'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'cast_spaces' => false, 'type_declaration_spaces' => false,
'binary_operator_spaces' => [ 'cast_spaces' => false,
'default' => 'at_least_single_space',
'operators' => [ // complex rules
'=>' => 'align_single_space_by_scope', 'array_syntax' => ['syntax' => 'short'],
'=' => 'align_single_space_minimal_by_scope', 'binary_operator_spaces' => [
'??=' => 'align_single_space_minimal_by_scope', 'default' => 'at_least_single_space',
], 'operators' => [
], '=>' => 'align_single_space_by_scope',
'void_return' => true, '=' => 'align_single_space_minimal_by_scope',
]) '??=' => 'align_single_space_minimal_by_scope',
],
],
])
->setFinder($finder); ->setFinder($finder);