Files
netslim-core/.php-cs-fixer.dist.php
2026-03-20 22:13:41 +01:00

37 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
$directories = array_values(array_filter([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/config',
], static fn (string $directory): bool => is_dir($directory)));
$finder = PhpCsFixer\Finder::create()
->in($directories)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'@PSR12' => true,
'array_indentation' => true,
'binary_operator_spaces' => ['default' => 'single_space'],
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements' => ['return', 'throw', 'try']],
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'final_class' => false,
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'ordered_types' => ['sort_algorithm' => 'alpha'],
'single_import_per_statement' => true,
'single_line_empty_body' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'parameters']],
]);