|
| 1 | +<?php |
| 2 | + |
| 3 | +$header = <<<'EOF' |
| 4 | +This file is part of Ymir Laravel Bridge. |
| 5 | +
|
| 6 | +(c) Carl Alexander <[email protected]> |
| 7 | +
|
| 8 | +For the full copyright and license information, please view the LICENSE |
| 9 | +file that was distributed with this source code. |
| 10 | +EOF; |
| 11 | + |
| 12 | +$finder = PhpCsFixer\Finder::create() |
| 13 | + ->in([ |
| 14 | + __DIR__ . '/src', |
| 15 | + __DIR__ . '/tests', |
| 16 | + ]) |
| 17 | +; |
| 18 | + |
| 19 | +$config = new PhpCsFixer\Config(); |
| 20 | +$config |
| 21 | + ->setRiskyAllowed(true) |
| 22 | + ->setRules([ |
| 23 | + '@Symfony' => true, |
| 24 | + '@Symfony:risky' => true, |
| 25 | + 'align_multiline_comment' => true, |
| 26 | + 'array_syntax' => ['syntax' => 'short'], |
| 27 | + 'blank_line_before_statement' => true, |
| 28 | + 'combine_consecutive_issets' => true, |
| 29 | + 'combine_consecutive_unsets' => true, |
| 30 | + 'declare_strict_types' => true, |
| 31 | + // one should use PHPUnit methods to set up expected exception instead of annotations |
| 32 | + 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp']], |
| 33 | + 'explicit_string_variable' => true, |
| 34 | + 'header_comment' => ['header' => $header], |
| 35 | + 'heredoc_to_nowdoc' => true, |
| 36 | + 'list_syntax' => ['syntax' => 'long'], |
| 37 | + 'method_chaining_indentation' => false, |
| 38 | + 'native_function_invocation' => false, |
| 39 | + 'native_constant_invocation' => false, |
| 40 | + 'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], |
| 41 | + 'no_null_property_initialization' => true, |
| 42 | + 'echo_tag_syntax' => ['format' => 'long'], |
| 43 | + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => false], |
| 44 | + 'no_unneeded_curly_braces' => true, |
| 45 | + 'no_unneeded_final_method' => true, |
| 46 | + 'no_unreachable_default_argument_value' => true, |
| 47 | + 'no_useless_else' => true, |
| 48 | + 'no_useless_return' => true, |
| 49 | + 'ordered_class_elements' => [ |
| 50 | + 'order' => [ |
| 51 | + 'use_trait', |
| 52 | + 'constant_public', |
| 53 | + 'constant_protected', |
| 54 | + 'constant_private', |
| 55 | + 'property_public', |
| 56 | + 'property_protected', |
| 57 | + 'property_private', |
| 58 | + 'construct', |
| 59 | + 'destruct', |
| 60 | + 'magic', |
| 61 | + 'phpunit', |
| 62 | + 'method_public_static', |
| 63 | + 'method_protected_static', |
| 64 | + 'method_private_static', |
| 65 | + 'method_public', |
| 66 | + 'method_public_abstract', |
| 67 | + 'method_protected', |
| 68 | + 'method_protected_abstract', |
| 69 | + 'method_private', |
| 70 | + ], |
| 71 | + 'sort_algorithm' => 'alpha' |
| 72 | + ], |
| 73 | + 'ordered_imports' => true, |
| 74 | + 'php_unit_construct' => true, |
| 75 | + 'php_unit_method_casing' => ['case' => 'camel_case'], |
| 76 | + 'php_unit_test_class_requires_covers' => true, |
| 77 | + 'php_unit_dedicate_assert' => true, |
| 78 | + 'phpdoc_order' => true, |
| 79 | + 'phpdoc_types_order' => ['null_adjustment' => 'always_last'], |
| 80 | + 'semicolon_after_instruction' => true, |
| 81 | + 'single_line_comment_style' => true, |
| 82 | + 'yoda_style' => true, |
| 83 | + ]) |
| 84 | + ->setFinder($finder) |
| 85 | +; |
| 86 | + |
| 87 | +return $config; |
0 commit comments