1<?php 2 3$finder = PhpCsFixer\Finder::create() 4 ->in([__DIR__ . '/lib', __DIR__ . '/tests']); 5 6return (new PhpCsFixer\Config()) 7 ->setRules([ 8 '@PSR2' => true, 9 'array_syntax' => ['syntax' => 'short'], 10 'binary_operator_spaces' => true, 11 'blank_line_before_statement' => ['statements' => ['return', 'try']], 12 'braces' => ['allow_single_line_anonymous_class_with_empty_body' => true, 'allow_single_line_closure' => true], 13 'cast_spaces' => true, 14 'class_attributes_separation' => ['elements' => ['method' => 'one']], 15 'clean_namespace' => true, 16 'compact_nullable_typehint' => true, 17 'concat_space' => ['spacing' => 'one'], 18 'declare_equal_normalize' => true, 19 'fopen_flag_order' => true, 20 'fopen_flags' => true, 21 'full_opening_tag' => true, 22 'function_typehint_space' => true, 23 'implode_call' => true, 24 'is_null' => true, 25 'lambda_not_used_import' => true, 26 'linebreak_after_opening_tag' => true, 27 'lowercase_cast' => true, 28 'lowercase_static_reference' => true, 29 'magic_constant_casing' => true, 30 'magic_method_casing' => true, 31 'mb_str_functions' => true, 32 'native_function_casing' => true, 33 'native_function_type_declaration_casing' => true, 34 'new_with_braces' => true, 35 'no_alias_functions' => true, 36 'no_blank_lines_after_class_opening' => true, 37 'no_blank_lines_after_phpdoc' => true, 38 'no_empty_comment' => true, 39 'no_empty_phpdoc' => true, 40 'no_empty_statement' => true, 41 'normalize_index_brace' => true, 42 'no_extra_blank_lines' => [ 43 'tokens' => [ 44 'break', 45 'case', 46 'continue', 47 'curly_brace_block', 48 'default', 49 'extra', 50 'parenthesis_brace_block', 51 'return', 52 'square_brace_block', 53 'switch', 54 'throw', 55 'use', 56 'use_trait', 57 ], 58 ], 59 'no_leading_import_slash' => true, 60 'no_leading_namespace_whitespace' => true, 61 'no_singleline_whitespace_before_semicolons' => true, 62 'no_trailing_comma_in_singleline_array' => true, 63 'no_unreachable_default_argument_value' => true, 64 'no_unused_imports' => true, 65 'no_useless_else' => true, 66 'no_useless_return' => true, 67 'no_useless_sprintf' => true, 68 'no_whitespace_in_blank_line' => true, 69 'object_operator_without_whitespace' => true, 70 'ordered_class_elements' => true, 71 'ordered_imports' => true, 72 'php_unit_construct' => true, 73 'php_unit_dedicate_assert' => false, 74 'php_unit_expectation' => ['target' => '5.6'], 75 'php_unit_method_casing' => ['case' => 'camel_case'], 76 'php_unit_mock_short_will_return' => true, 77 'php_unit_mock' => true, 78 'php_unit_namespaced' => ['target' => '5.7'], 79 'php_unit_no_expectation_annotation' => true, 80 'php_unit_set_up_tear_down_visibility' => true, 81 'php_unit_test_case_static_method_calls' => ['call_type' => 'this'], 82 'phpdoc_add_missing_param_annotation' => true, 83 'phpdoc_indent' => true, 84 'phpdoc_no_access' => true, 85 // 'phpdoc_no_empty_return' => true, // disabled to allow forward compatibility with PHP 8.1 86 'phpdoc_no_package' => true, 87 'phpdoc_order_by_value' => ['annotations' => ['covers', 'group', 'throws']], 88 'phpdoc_order' => true, 89 'phpdoc_return_self_reference' => true, 90 'phpdoc_scalar' => true, 91 'phpdoc_single_line_var_spacing' => true, 92 'phpdoc_trim' => true, 93 'phpdoc_types' => true, 94 'phpdoc_var_annotation_correct_order' => true, 95 'psr_autoloading' => true, 96 'self_accessor' => true, 97 'set_type_to_cast' => true, 98 'short_scalar_cast' => true, 99 'single_blank_line_before_namespace' => true, 100 'single_quote' => true, 101 'single_space_after_construct' => true, 102 'single_trait_insert_per_statement' => true, 103 'space_after_semicolon' => true, 104 'standardize_not_equals' => true, 105 'strict_param' => true, 106 'switch_continue_to_break' => true, 107 'ternary_operator_spaces' => true, 108 'ternary_to_elvis_operator' => true, 109 'trailing_comma_in_multiline' => ['elements' => ['arrays']], 110 'trim_array_spaces' => true, 111 'unary_operator_spaces' => true, 112 'visibility_required' => ['elements' => ['method', 'property']], 113 'whitespace_after_comma_in_array' => true, 114 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], 115 ]) 116 ->setRiskyAllowed(true) 117 ->setFinder($finder); 118