|
| 1 | +<?php |
| 2 | + |
| 3 | +$finder = PhpCsFixer\Finder::create() |
| 4 | + ->in('src') |
| 5 | + ->in('test') |
| 6 | + ->notName('function.php'); // no_superfluous_php_doc_tags does not play well with function.php |
| 7 | + // basically treat rule & file as mutually exclusive; either have one or the other |
| 8 | + |
| 9 | +return (new PhpCsFixer\Config()) |
| 10 | + ->setRules([ |
| 11 | + '@PHP70Migration' => true, |
| 12 | + '@PHP70Migration:risky' => true, |
| 13 | + '@PHPUnit60Migration:risky' => true, |
| 14 | + '@PhpCsFixer' => true, |
| 15 | + '@PhpCsFixer:risky' => true, |
| 16 | + 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], |
| 17 | + 'binary_operator_spaces' => [ |
| 18 | + 'default' => 'align_single_space_minimal', |
| 19 | + 'operators' => ['||' => null, '&&' => null] |
| 20 | + ], |
| 21 | + 'class_attributes_separation' => [ |
| 22 | + 'elements' => [ |
| 23 | + 'const' => 'only_if_meta', |
| 24 | + 'property' => 'only_if_meta', |
| 25 | + 'method' => 'one', |
| 26 | + 'trait_import' => 'none', |
| 27 | + ] |
| 28 | + ], |
| 29 | + 'class_definition' => [ |
| 30 | + 'single_item_single_line' => true, |
| 31 | + 'multi_line_extends_each_single_line' => true, |
| 32 | + ], |
| 33 | + 'concat_space' => ['spacing' => 'one'], |
| 34 | + 'control_structure_continuation_position' => true, |
| 35 | + 'date_time_immutable' => true, |
| 36 | + 'declare_parentheses' => true, |
| 37 | + 'final_class' => true, |
| 38 | + 'final_public_method_for_abstract_class' => true, |
| 39 | + 'global_namespace_import' => true, |
| 40 | + 'list_syntax' => ['syntax' => 'long'], // PHP 7.0 compatibility |
| 41 | + 'mb_str_functions' => true, |
| 42 | + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], |
| 43 | + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], |
| 44 | + 'no_unset_on_property' => false, |
| 45 | + 'operator_linebreak' => ['position' => 'beginning', 'only_booleans' => false], |
| 46 | + 'ordered_class_elements' => ['sort_algorithm' => 'alpha'], |
| 47 | + 'ordered_interfaces' => true, |
| 48 | + 'ordered_imports' => ['imports_order' => ['const', 'class', 'function']], |
| 49 | + 'phpdoc_line_span' => ['const' => 'single', 'property' => 'single'], |
| 50 | + 'phpdoc_no_empty_return' => false, // PHP 7.0 & PHPStan compatibility |
| 51 | + 'phpdoc_order_by_value' => ['annotations' => ['covers', 'depends', 'group', 'throws']], |
| 52 | + 'phpdoc_types_order' => ['null_adjustment' => 'always_last'], |
| 53 | + 'php_unit_test_case_static_method_calls' => ['call_type' => 'this'], |
| 54 | + 'php_unit_test_class_requires_covers' => false, |
| 55 | + 'psr_autoloading' => ['dir' => 'src'], |
| 56 | + 'regular_callable_call' => true, |
| 57 | + 'self_static_accessor' => true, |
| 58 | + 'static_lambda' => true, |
| 59 | + 'simplified_null_return' => true, |
| 60 | + 'simplified_if_return' => true, |
| 61 | + 'visibility_required' => ['elements' => ['property', 'method']], // PHP 7.0 compatibility |
| 62 | + 'yoda_style' => false, |
| 63 | + ]) |
| 64 | + ->setFinder($finder) |
| 65 | + ->setRiskyAllowed(true); |
0 commit comments