Files
sqrtspace-php/.php-cs-fixer.php
2025-07-20 15:08:16 -04:00

90 lines
3.0 KiB
PHP

<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->exclude('build')
->exclude('storage')
->exclude('bootstrap/cache')
->notPath('*.blade.php')
->notName('*.md')
->notName('*.xml')
->notName('*.yml')
->notName('_ide_helper.php')
->notName('_ide_helper_models.php')
->notName('.phpstorm.meta.php');
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PSR12' => true,
'@PHP81Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'single_line_after_imports' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'declare_strict_types' => true,
'single_blank_line_at_eof' => true,
'elseif' => true,
'function_declaration' => true,
'indentation_type' => true,
'line_ending' => true,
'lowercase_keywords' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'no_closing_tag' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'encoding' => true,
'full_opening_tag' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
],
'blank_line_before_statement' => [
'statements' => ['return'],
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
],
],
'concat_space' => [
'spacing' => 'one',
],
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => true,
'short_scalar_cast' => true,
'single_quote' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'visibility_required' => true,
'void_return' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
])
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true);