.php_cs.dist 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of the php-code-coverage package.
  4. (c) Sebastian Bergmann <sebastian@phpunit.de>
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. EOF;
  8. return PhpCsFixer\Config::create()
  9. ->setRiskyAllowed(true)
  10. ->setRules(
  11. [
  12. 'align_multiline_comment' => true,
  13. 'array_indentation' => true,
  14. 'array_syntax' => ['syntax' => 'short'],
  15. 'binary_operator_spaces' => [
  16. 'operators' => [
  17. '=' => 'align',
  18. '=>' => 'align',
  19. ],
  20. ],
  21. 'blank_line_after_namespace' => true,
  22. 'blank_line_before_statement' => [
  23. 'statements' => [
  24. 'break',
  25. 'continue',
  26. 'declare',
  27. 'do',
  28. 'for',
  29. 'foreach',
  30. 'if',
  31. 'include',
  32. 'include_once',
  33. 'require',
  34. 'require_once',
  35. 'return',
  36. 'switch',
  37. 'throw',
  38. 'try',
  39. 'while',
  40. 'yield',
  41. ],
  42. ],
  43. 'braces' => true,
  44. 'cast_spaces' => true,
  45. 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
  46. 'combine_consecutive_issets' => true,
  47. 'combine_consecutive_unsets' => true,
  48. 'compact_nullable_typehint' => true,
  49. 'concat_space' => ['spacing' => 'one'],
  50. 'declare_equal_normalize' => ['space' => 'none'],
  51. 'dir_constant' => true,
  52. 'elseif' => true,
  53. 'encoding' => true,
  54. 'full_opening_tag' => true,
  55. 'function_declaration' => true,
  56. 'header_comment' => ['header' => $header, 'separate' => 'none'],
  57. 'indentation_type' => true,
  58. 'is_null' => true,
  59. 'line_ending' => true,
  60. 'list_syntax' => ['syntax' => 'short'],
  61. 'logical_operators' => true,
  62. 'lowercase_cast' => true,
  63. 'lowercase_constants' => true,
  64. 'lowercase_keywords' => true,
  65. 'lowercase_static_reference' => true,
  66. 'magic_constant_casing' => true,
  67. 'method_argument_space' => ['ensure_fully_multiline' => true],
  68. 'modernize_types_casting' => true,
  69. 'multiline_comment_opening_closing' => true,
  70. 'multiline_whitespace_before_semicolons' => true,
  71. 'native_constant_invocation' => true,
  72. 'native_function_casing' => true,
  73. 'native_function_invocation' => true,
  74. 'new_with_braces' => false,
  75. 'no_alias_functions' => true,
  76. 'no_alternative_syntax' => true,
  77. 'no_blank_lines_after_class_opening' => true,
  78. 'no_blank_lines_after_phpdoc' => true,
  79. 'no_blank_lines_before_namespace' => true,
  80. 'no_closing_tag' => true,
  81. 'no_empty_comment' => true,
  82. 'no_empty_phpdoc' => true,
  83. 'no_empty_statement' => true,
  84. 'no_extra_blank_lines' => true,
  85. 'no_homoglyph_names' => true,
  86. 'no_leading_import_slash' => true,
  87. 'no_leading_namespace_whitespace' => true,
  88. 'no_mixed_echo_print' => ['use' => 'print'],
  89. 'no_multiline_whitespace_around_double_arrow' => true,
  90. 'no_null_property_initialization' => true,
  91. 'no_php4_constructor' => true,
  92. 'no_short_bool_cast' => true,
  93. 'no_short_echo_tag' => true,
  94. 'no_singleline_whitespace_before_semicolons' => true,
  95. 'no_spaces_after_function_name' => true,
  96. 'no_spaces_inside_parenthesis' => true,
  97. 'no_superfluous_elseif' => true,
  98. 'no_superfluous_phpdoc_tags' => true,
  99. 'no_trailing_comma_in_list_call' => true,
  100. 'no_trailing_comma_in_singleline_array' => true,
  101. 'no_trailing_whitespace' => true,
  102. 'no_trailing_whitespace_in_comment' => true,
  103. 'no_unneeded_control_parentheses' => true,
  104. 'no_unneeded_curly_braces' => true,
  105. 'no_unneeded_final_method' => true,
  106. 'no_unreachable_default_argument_value' => true,
  107. 'no_unset_on_property' => true,
  108. 'no_unused_imports' => true,
  109. 'no_useless_else' => true,
  110. 'no_useless_return' => true,
  111. 'no_whitespace_before_comma_in_array' => true,
  112. 'no_whitespace_in_blank_line' => true,
  113. 'non_printable_character' => true,
  114. 'normalize_index_brace' => true,
  115. 'object_operator_without_whitespace' => true,
  116. 'ordered_class_elements' => [
  117. 'order' => [
  118. 'use_trait',
  119. 'constant_public',
  120. 'constant_protected',
  121. 'constant_private',
  122. 'property_public_static',
  123. 'property_protected_static',
  124. 'property_private_static',
  125. 'property_public',
  126. 'property_protected',
  127. 'property_private',
  128. 'method_public_static',
  129. 'construct',
  130. 'destruct',
  131. 'magic',
  132. 'phpunit',
  133. 'method_public',
  134. 'method_protected',
  135. 'method_private',
  136. 'method_protected_static',
  137. 'method_private_static',
  138. ],
  139. ],
  140. 'ordered_imports' => true,
  141. 'phpdoc_add_missing_param_annotation' => true,
  142. 'phpdoc_align' => true,
  143. 'phpdoc_annotation_without_dot' => true,
  144. 'phpdoc_indent' => true,
  145. 'phpdoc_no_access' => true,
  146. 'phpdoc_no_empty_return' => true,
  147. 'phpdoc_no_package' => true,
  148. 'phpdoc_order' => true,
  149. 'phpdoc_return_self_reference' => true,
  150. 'phpdoc_scalar' => true,
  151. 'phpdoc_separation' => true,
  152. 'phpdoc_single_line_var_spacing' => true,
  153. 'phpdoc_to_comment' => true,
  154. 'phpdoc_trim' => true,
  155. 'phpdoc_trim_consecutive_blank_line_separation' => true,
  156. 'phpdoc_types' => true,
  157. 'phpdoc_types_order' => true,
  158. 'phpdoc_var_without_name' => true,
  159. 'pow_to_exponentiation' => true,
  160. 'protected_to_private' => true,
  161. 'return_assignment' => true,
  162. 'return_type_declaration' => ['space_before' => 'none'],
  163. 'self_accessor' => true,
  164. 'semicolon_after_instruction' => true,
  165. 'set_type_to_cast' => true,
  166. 'short_scalar_cast' => true,
  167. 'simplified_null_return' => true,
  168. 'single_blank_line_at_eof' => true,
  169. 'single_import_per_statement' => true,
  170. 'single_line_after_imports' => true,
  171. 'single_quote' => true,
  172. 'standardize_not_equals' => true,
  173. 'ternary_to_null_coalescing' => true,
  174. 'trailing_comma_in_multiline_array' => true,
  175. 'trim_array_spaces' => true,
  176. 'unary_operator_spaces' => true,
  177. 'visibility_required' => true,
  178. 'void_return' => true,
  179. 'whitespace_after_comma_in_array' => true,
  180. ]
  181. )
  182. ->setFinder(
  183. PhpCsFixer\Finder::create()
  184. ->files()
  185. ->in(__DIR__ . '/src')
  186. );