<?php

$finder = PhpCsFixer\Finder::create()
    ->exclude(
        [
            'wp',
            'vendor',
            'plugins',
            'mu-plugins',
            'content/plugins',
            'content/mu-plugins',
            'content/themes/*/vendor',
            'themes/*/vendor',
            'plugins',
            'mu-plugins',
            'public/wp',
            'public/content/plugins',
            'public/content/mu-plugins',
            'public/content/themes/*/vendor',
        ]
    )->in(__DIR__);

$config = new PhpCsFixer\Config();
$config->setUsingCache(false);

return $config->setRules([
    '@PSR12' => true,
    'concat_space' => ['spacing' => 'one'],
    'single_space_around_construct' => true,
    'blank_line_after_namespace' => true,
    'no_extra_blank_lines' => ['tokens' => ['use']],
    'blank_line_after_opening_tag' => true,
    'blank_line_between_import_groups' => true,
    'class_definition' => true,
    'compact_nullable_type_declaration' => true,
    'constant_case' => true,
    'declare_equal_normalize' => true,
    'elseif' => true,
    'encoding' => true,
    'full_opening_tag' => true,
    'function_declaration' => true,
    'indentation_type' => true,
    'line_ending' => true,
    'lowercase_cast' => true,
    'lowercase_keywords' => true,
    'lowercase_static_reference' => true,
    'method_argument_space' => true,
    'new_with_parentheses' => true,
    'no_blank_lines_after_class_opening' => true,
    'no_break_comment' => true,
    'no_closing_tag' => true,
    'no_leading_import_slash' => true,
    'no_space_around_double_colon' => true,
    'no_spaces_after_function_name' => true,
    'spaces_inside_parentheses' => false,
    'no_trailing_whitespace' => true,
    'no_trailing_whitespace_in_comment' => true,
    'no_unused_imports' => true,
    'no_whitespace_in_blank_line' => true,
    'ordered_class_elements' => true,
    'ordered_imports' => true,
    'return_type_declaration' => true,
    'short_scalar_cast' => true,
    'single_blank_line_at_eof' => true,
    'blank_lines_before_namespace' => true,
    'single_class_element_per_statement' => true,
    'single_import_per_statement' => true,
    'single_line_after_imports' => true,
    'single_trait_insert_per_statement' => true,
    'switch_case_semicolon_to_colon' => true,
    'switch_case_space' => true,
    'ternary_operator_spaces' => true,
    'visibility_required' => true,
    'trailing_comma_in_multiline' => true,
    'array_syntax' => ['syntax' => 'short'],
    'array_indentation' => true,
])->setFinder($finder);
