|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PhpCsFixer\Config; |
| 6 | +use PhpCsFixer\Finder; |
| 7 | + |
| 8 | +return (new Config()) |
| 9 | + ->setFinder( |
| 10 | + (new Finder()) |
| 11 | + ->in(__DIR__.'/../Documentation') |
| 12 | + ) |
| 13 | + ->setRiskyAllowed(true) |
| 14 | + ->setRules([ |
| 15 | + '@DoctrineAnnotation' => true, |
| 16 | + // @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247 |
| 17 | + '@PER-CS1.0' => true, |
| 18 | + 'array_indentation' => true, |
| 19 | + 'array_syntax' => ['syntax' => 'short'], |
| 20 | + 'cast_spaces' => ['space' => 'none'], |
| 21 | + // @todo: Can be dropped once we enable @PER-CS2.0 |
| 22 | + 'concat_space' => ['spacing' => 'one'], |
| 23 | + 'declare_equal_normalize' => ['space' => 'none'], |
| 24 | + 'declare_parentheses' => true, |
| 25 | + 'dir_constant' => true, |
| 26 | + // @todo: Can be dropped once we enable @PER-CS2.0 |
| 27 | + 'function_declaration' => [ |
| 28 | + 'closure_fn_spacing' => 'none', |
| 29 | + ], |
| 30 | + 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], |
| 31 | + 'type_declaration_spaces' => true, |
| 32 | + 'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], |
| 33 | + 'list_syntax' => ['syntax' => 'short'], |
| 34 | + // @todo: Can be dropped once we enable @PER-CS2.0 |
| 35 | + 'method_argument_space' => true, |
| 36 | + 'modernize_strpos' => true, |
| 37 | + 'modernize_types_casting' => true, |
| 38 | + 'native_function_casing' => true, |
| 39 | + 'no_alias_functions' => true, |
| 40 | + 'no_blank_lines_after_phpdoc' => true, |
| 41 | + 'no_empty_phpdoc' => true, |
| 42 | + 'no_empty_statement' => true, |
| 43 | + 'no_extra_blank_lines' => true, |
| 44 | + 'no_leading_namespace_whitespace' => true, |
| 45 | + 'no_null_property_initialization' => true, |
| 46 | + 'no_short_bool_cast' => true, |
| 47 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 48 | + 'no_superfluous_elseif' => true, |
| 49 | + 'no_trailing_comma_in_singleline' => true, |
| 50 | + 'no_unneeded_control_parentheses' => true, |
| 51 | + 'no_unused_imports' => true, |
| 52 | + 'no_useless_nullsafe_operator' => true, |
| 53 | + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], |
| 54 | + 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], |
| 55 | + 'php_unit_mock_short_will_return' => true, |
| 56 | + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], |
| 57 | + 'phpdoc_no_access' => true, |
| 58 | + 'phpdoc_no_empty_return' => true, |
| 59 | + 'phpdoc_no_package' => true, |
| 60 | + 'phpdoc_scalar' => true, |
| 61 | + 'phpdoc_trim' => true, |
| 62 | + 'phpdoc_types' => true, |
| 63 | + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], |
| 64 | + 'return_type_declaration' => ['space_before' => 'none'], |
| 65 | + 'single_quote' => true, |
| 66 | + 'single_space_around_construct' => true, |
| 67 | + 'single_line_comment_style' => ['comment_types' => ['hash']], |
| 68 | + // @todo: Can be dropped once we enable @PER-CS2.0 |
| 69 | + 'single_line_empty_body' => true, |
| 70 | + 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']], |
| 71 | + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], |
| 72 | + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], |
| 73 | + |
| 74 | + // We need this for documentation! |
| 75 | + 'no_useless_else' => false, // We want to preserve else with comments only |
| 76 | + ]); |
0 commit comments