|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +$header = <<<'HEADER' |
| 6 | +This file is part of the API Platform project. |
| 7 | +
|
| 8 | +(c) Kévin Dunglas <dunglas@gmail.com> |
| 9 | +
|
| 10 | +For the full copyright and license information, please view the LICENSE |
| 11 | +file that was distributed with this source code. |
| 12 | +HEADER; |
| 13 | + |
| 14 | +$finder = PhpCsFixer\Finder::create() |
| 15 | + ->in(__DIR__) |
| 16 | + ->exclude([ |
| 17 | + 'src/Core/Bridge/Symfony/Maker/Resources/skeleton', |
| 18 | + 'tests/Fixtures/app/var', |
| 19 | + 'tests/Fixtures/Symfony/Maker', |
| 20 | + ]) |
| 21 | + ->notPath('src/Symfony/Bundle/DependencyInjection/Configuration.php') |
| 22 | + ->notPath('src/Annotation/ApiFilter.php') // temporary |
| 23 | + ->notPath('src/Annotation/ApiProperty.php') // temporary |
| 24 | + ->notPath('src/Annotation/ApiResource.php') // temporary |
| 25 | + ->notPath('src/Annotation/ApiSubresource.php') // temporary |
| 26 | + ->notPath('tests/Fixtures/TestBundle/Entity/DummyPhp8.php') // temporary |
| 27 | + ->notPath('tests/Fixtures/TestBundle/Enum/EnumWithDescriptions.php') // PHPDoc on enum cases |
| 28 | + ->notPath('tests/Fixtures/TestBundle/Enum/GamePlayMode.php') // PHPDoc on enum cases |
| 29 | + ->notPath('tests/Fixtures/TestBundle/Enum/GenderTypeEnum.php') // PHPDoc on enum cases |
| 30 | + ->append([ |
| 31 | + 'tests/Fixtures/app/console', |
| 32 | + ]); |
| 33 | + |
| 34 | +return (new PhpCsFixer\Config()) |
| 35 | + ->setRiskyAllowed(true) |
| 36 | + ->setRules([ |
| 37 | + '@DoctrineAnnotation' => true, |
| 38 | + '@PHP71Migration' => true, |
| 39 | + '@PHP71Migration:risky' => true, |
| 40 | + '@PHPUnit60Migration:risky' => true, |
| 41 | + '@Symfony' => true, |
| 42 | + '@Symfony:risky' => true, |
| 43 | + 'align_multiline_comment' => [ |
| 44 | + 'comment_type' => 'phpdocs_like', |
| 45 | + ], |
| 46 | + 'array_indentation' => true, |
| 47 | + 'compact_nullable_typehint' => true, |
| 48 | + 'doctrine_annotation_array_assignment' => [ |
| 49 | + 'operator' => '=', |
| 50 | + ], |
| 51 | + 'doctrine_annotation_spaces' => [ |
| 52 | + 'after_array_assignments_equals' => false, |
| 53 | + 'before_array_assignments_equals' => false, |
| 54 | + ], |
| 55 | + 'explicit_indirect_variable' => true, |
| 56 | + 'fully_qualified_strict_types' => true, |
| 57 | + 'header_comment' => [ |
| 58 | + 'header' => $header, |
| 59 | + 'location' => 'after_open', |
| 60 | + ], |
| 61 | + 'logical_operators' => true, |
| 62 | + 'multiline_comment_opening_closing' => true, |
| 63 | + 'multiline_whitespace_before_semicolons' => [ |
| 64 | + 'strategy' => 'no_multi_line', |
| 65 | + ], |
| 66 | + 'no_alternative_syntax' => true, |
| 67 | + 'no_extra_blank_lines' => [ |
| 68 | + 'tokens' => [ |
| 69 | + 'break', |
| 70 | + 'continue', |
| 71 | + 'curly_brace_block', |
| 72 | + 'extra', |
| 73 | + 'parenthesis_brace_block', |
| 74 | + 'return', |
| 75 | + 'square_brace_block', |
| 76 | + 'throw', |
| 77 | + 'use', |
| 78 | + ], |
| 79 | + ], |
| 80 | + 'no_superfluous_elseif' => true, |
| 81 | + 'no_superfluous_phpdoc_tags' => [ |
| 82 | + 'allow_mixed' => false, |
| 83 | + ], |
| 84 | + 'no_unset_cast' => true, |
| 85 | + 'no_unset_on_property' => true, |
| 86 | + 'no_useless_else' => true, |
| 87 | + 'no_useless_return' => true, |
| 88 | + 'ordered_imports' => [ |
| 89 | + 'imports_order' => [ |
| 90 | + 'class', |
| 91 | + 'function', |
| 92 | + 'const', |
| 93 | + ], |
| 94 | + 'sort_algorithm' => 'alpha', |
| 95 | + ], |
| 96 | + 'php_unit_method_casing' => [ |
| 97 | + 'case' => 'camel_case', |
| 98 | + ], |
| 99 | + 'php_unit_set_up_tear_down_visibility' => true, |
| 100 | + 'php_unit_test_annotation' => [ |
| 101 | + 'style' => 'prefix', |
| 102 | + ], |
| 103 | + 'phpdoc_add_missing_param_annotation' => [ |
| 104 | + 'only_untyped' => true, |
| 105 | + ], |
| 106 | + 'phpdoc_no_alias_tag' => true, |
| 107 | + 'phpdoc_order' => true, |
| 108 | + 'phpdoc_trim_consecutive_blank_line_separation' => true, |
| 109 | + 'phpdoc_var_annotation_correct_order' => true, |
| 110 | + 'return_assignment' => true, |
| 111 | + 'strict_param' => true, |
| 112 | + 'visibility_required' => [ |
| 113 | + 'elements' => [ |
| 114 | + 'const', |
| 115 | + 'method', |
| 116 | + 'property', |
| 117 | + ], |
| 118 | + ], |
| 119 | + ]) |
| 120 | + ->setFinder($finder); |
0 commit comments