|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This source file is proprietary and part of Rebilly. |
| 4 | + * |
| 5 | + * (c) Rebilly SRL |
| 6 | + * Rebilly Ltd. |
| 7 | + * Rebilly Inc. |
| 8 | + * |
| 9 | + * @see https://www.rebilly.com |
| 10 | + */ |
| 11 | + |
| 12 | +declare(strict_types=1); |
| 13 | + |
| 14 | +use PhpCsFixer\Config; |
| 15 | +use PhpCsFixer\Finder; |
| 16 | + |
| 17 | +$header = <<<'EOF' |
| 18 | +This source file is proprietary and part of Rebilly. |
| 19 | +
|
| 20 | +(c) Rebilly SRL |
| 21 | + Rebilly Ltd. |
| 22 | + Rebilly Inc. |
| 23 | +
|
| 24 | +@see https://www.rebilly.com |
| 25 | +EOF; |
| 26 | + |
| 27 | +$rules = [ |
| 28 | + '@PSR2' => true, |
| 29 | + 'array_syntax' => ['syntax' => 'short'], |
| 30 | + 'binary_operator_spaces' => true, |
| 31 | + 'blank_line_before_statement' => true, |
| 32 | + 'cast_spaces' => true, |
| 33 | + 'class_attributes_separation' => true, |
| 34 | + 'combine_consecutive_issets' => true, |
| 35 | + 'combine_consecutive_unsets' => true, |
| 36 | + 'compact_nullable_typehint' => true, |
| 37 | + 'concat_space' => ['spacing' => 'one'], |
| 38 | + 'declare_equal_normalize' => ['space' => 'none'], |
| 39 | + // 'declare_strict_types' => true, |
| 40 | + 'dir_constant' => true, |
| 41 | + 'ereg_to_preg' => true, |
| 42 | + 'explicit_indirect_variable' => true, |
| 43 | + 'explicit_string_variable' => true, |
| 44 | + 'general_phpdoc_annotation_remove' => ['annotations' => ['author', 'version']], |
| 45 | + 'global_namespace_import' => [ |
| 46 | + 'import_classes' => true, |
| 47 | + 'import_constants' => true, |
| 48 | + 'import_functions' => true, |
| 49 | + ], |
| 50 | + // 'header_comment' => [ |
| 51 | + // 'header' => $header, |
| 52 | + // 'commentType' => 'PHPDoc', |
| 53 | + // 'separate' => 'bottom', |
| 54 | + // 'location' => 'after_open', |
| 55 | + // ], |
| 56 | + 'heredoc_to_nowdoc' => true, |
| 57 | + 'increment_style' => ['style' => 'pre'], |
| 58 | + 'list_syntax' => ['syntax' => 'short'], |
| 59 | + 'lowercase_cast' => true, |
| 60 | + 'magic_constant_casing' => true, |
| 61 | + 'mb_str_functions' => true, |
| 62 | + 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], |
| 63 | + 'method_chaining_indentation' => true, |
| 64 | + 'modernize_types_casting' => true, |
| 65 | + 'native_function_casing' => true, |
| 66 | + // 'native_function_invocation' => true, |
| 67 | + 'new_with_braces' => true, |
| 68 | + 'no_alias_functions' => true, |
| 69 | + 'no_blank_lines_after_class_opening' => true, |
| 70 | + 'no_blank_lines_after_phpdoc' => true, |
| 71 | + 'no_empty_comment' => true, |
| 72 | + 'no_empty_phpdoc' => true, |
| 73 | + 'no_empty_statement' => true, |
| 74 | + 'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], |
| 75 | + 'no_homoglyph_names' => true, |
| 76 | + 'no_leading_import_slash' => true, |
| 77 | + 'no_leading_namespace_whitespace' => true, |
| 78 | + 'no_mixed_echo_print' => true, |
| 79 | + 'no_multiline_whitespace_around_double_arrow' => true, |
| 80 | + 'no_null_property_initialization' => true, |
| 81 | + 'no_php4_constructor' => true, |
| 82 | + 'no_short_bool_cast' => true, |
| 83 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 84 | + 'no_spaces_around_offset' => true, |
| 85 | + 'no_superfluous_elseif' => true, |
| 86 | + 'no_trailing_comma_in_singleline_array' => true, |
| 87 | + 'no_unneeded_control_parentheses' => true, |
| 88 | + 'no_unneeded_curly_braces' => true, |
| 89 | + 'no_unneeded_final_method' => true, |
| 90 | + 'no_unreachable_default_argument_value' => true, |
| 91 | + 'no_unused_imports' => true, |
| 92 | + 'no_useless_else' => true, |
| 93 | + 'no_useless_return' => true, |
| 94 | + 'no_whitespace_before_comma_in_array' => true, |
| 95 | + 'no_whitespace_in_blank_line' => true, |
| 96 | + 'normalize_index_brace' => true, |
| 97 | + 'ordered_class_elements' => true, |
| 98 | + 'ordered_imports' => true, |
| 99 | + 'php_unit_construct' => true, |
| 100 | + 'php_unit_dedicate_assert' => true, |
| 101 | + 'php_unit_expectation' => true, |
| 102 | + 'php_unit_mock' => true, |
| 103 | + 'php_unit_namespaced' => true, |
| 104 | + 'php_unit_no_expectation_annotation' => true, |
| 105 | + 'php_unit_strict' => true, |
| 106 | + 'php_unit_test_annotation' => ['style' => 'prefix'], |
| 107 | + 'phpdoc_add_missing_param_annotation' => true, |
| 108 | + // Temporary disabled because @inheritdoc can be explicit inheritance tag now |
| 109 | + // see: https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/2619 |
| 110 | + // 'phpdoc_inline_tag' => true, |
| 111 | + 'phpdoc_no_access' => true, |
| 112 | + 'phpdoc_no_alias_tag' => true, |
| 113 | + 'phpdoc_no_empty_return' => true, |
| 114 | + 'phpdoc_no_package' => true, |
| 115 | + 'phpdoc_no_useless_inheritdoc' => true, |
| 116 | + 'phpdoc_order' => true, |
| 117 | + 'phpdoc_separation' => true, |
| 118 | + 'phpdoc_types_order' => true, |
| 119 | + 'phpdoc_var_without_name' => true, |
| 120 | + 'pow_to_exponentiation' => true, |
| 121 | + 'protected_to_private' => true, |
| 122 | + 'random_api_migration' => true, |
| 123 | + 'return_type_declaration' => true, |
| 124 | + 'self_accessor' => true, |
| 125 | + 'semicolon_after_instruction' => true, |
| 126 | + 'short_scalar_cast' => true, |
| 127 | + 'single_blank_line_before_namespace' => true, |
| 128 | + 'single_line_comment_style' => true, |
| 129 | + 'single_quote' => true, |
| 130 | + 'standardize_not_equals' => true, |
| 131 | + 'strict_comparison' => true, |
| 132 | + 'strict_param' => true, |
| 133 | + 'ternary_to_null_coalescing' => true, |
| 134 | + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
| 135 | + 'trim_array_spaces' => true, |
| 136 | + 'unary_operator_spaces' => true, |
| 137 | + 'yoda_style' => false, |
| 138 | + 'object_operator_without_whitespace' => true, |
| 139 | +]; |
| 140 | + |
| 141 | + |
| 142 | +$finder = (new Finder()) |
| 143 | + ->ignoreDotFiles(true) |
| 144 | + ->ignoreVCS(true) |
| 145 | + ->in([__DIR__ . '/src', __DIR__ . '/tests']) |
| 146 | + ->name('*.php') |
| 147 | + ->exclude('vendor'); |
| 148 | + |
| 149 | +return (new Config()) |
| 150 | + ->setFinder($finder) |
| 151 | + ->setRules($rules) |
| 152 | + ->setRiskyAllowed(true) |
| 153 | + ->setUsingCache(true); |
0 commit comments