xref: /web-php/.php-cs-fixer.php (revision 02931b93)
1<?php
2
3$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4
5$config = new PhpCsFixer\Config();
6
7$finder = $config->getFinder()
8    ->ignoreDotFiles(false)
9    ->in([
10        __DIR__ . '/src',
11        __DIR__ . '/tests',
12    ]);
13
14$config
15    ->setCacheFile(__DIR__ . '/.build/php-cs-fixer/php-cs-fixer.cache')
16    ->setRiskyAllowed(true)
17    ->setRules([
18        'array_indentation' => true,
19        'array_syntax' => true,
20        'binary_operator_spaces' => true,
21        'blank_line_after_namespace' => true,
22        'blank_line_after_opening_tag' => true,
23        'class_attributes_separation' => true,
24        'class_definition' => true,
25        'concat_space' => [
26            'spacing' => 'one',
27        ],
28        'constant_case' => true,
29        'elseif' => true,
30        'function_declaration' => true,
31        'include' => true,
32        'increment_style' => [
33            'style' => 'post',
34        ],
35        'indentation_type' => true,
36        'is_null' => true,
37        'line_ending' => true,
38        'new_with_parentheses' => true,
39        'no_extra_blank_lines' => true,
40        'no_mixed_echo_print' => true,
41        'no_singleline_whitespace_before_semicolons' => true,
42        'no_spaces_after_function_name' => true,
43        'no_superfluous_elseif' => true,
44        'no_trailing_whitespace' => true,
45        'ordered_class_elements' => true,
46        'random_api_migration' => true,
47        'single_space_around_construct' => [
48            'constructs_contain_a_single_space' => [
49                'yield_from',
50            ],
51            'constructs_preceded_by_a_single_space' => [],
52            'constructs_followed_by_a_single_space' => [],
53        ],
54        'strict_param' => true,
55        'switch_case_space' => true,
56        'ternary_operator_spaces' => true,
57        'trailing_comma_in_multiline' => [
58            'elements' => [
59                'arguments',
60                'arrays',
61                'match',
62                'parameters',
63            ],
64        ],
65        'trim_array_spaces' => true,
66        'unary_operator_spaces' => true,
67        'visibility_required' => true,
68        'void_return' => true,
69        'whitespace_after_comma_in_array' => true,
70    ]);
71
72return $config;
73