.php_cs.dist 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php declare(strict_types=1);
  2. $header = <<<'EOF'
  3. This file is part of exporter 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. 'declare_strict_types' => true,
  52. 'dir_constant' => true,
  53. 'elseif' => true,
  54. 'encoding' => true,
  55. 'full_opening_tag' => true,
  56. 'function_declaration' => true,
  57. 'header_comment' => ['header' => $header, 'separate' => 'none'],
  58. 'indentation_type' => true,
  59. 'is_null' => true,
  60. 'line_ending' => true,
  61. 'list_syntax' => ['syntax' => 'short'],
  62. 'logical_operators' => true,
  63. 'lowercase_cast' => true,
  64. 'lowercase_constants' => true,
  65. 'lowercase_keywords' => true,
  66. 'lowercase_static_reference' => true,
  67. 'magic_constant_casing' => true,
  68. 'method_argument_space' => ['ensure_fully_multiline' => true],
  69. 'modernize_types_casting' => true,
  70. 'multiline_comment_opening_closing' => true,
  71. 'multiline_whitespace_before_semicolons' => true,
  72. 'native_constant_invocation' => true,
  73. 'native_function_casing' => true,
  74. 'native_function_invocation' => true,
  75. 'new_with_braces' => false,
  76. 'no_alias_functions' => true,
  77. 'no_alternative_syntax' => true,
  78. 'no_blank_lines_after_class_opening' => true,
  79. 'no_blank_lines_after_phpdoc' => true,
  80. 'no_blank_lines_before_namespace' => true,
  81. 'no_closing_tag' => true,
  82. 'no_empty_comment' => true,
  83. 'no_empty_phpdoc' => true,
  84. 'no_empty_statement' => true,
  85. 'no_extra_blank_lines' => true,
  86. 'no_homoglyph_names' => true,
  87. 'no_leading_import_slash' => true,
  88. 'no_leading_namespace_whitespace' => true,
  89. 'no_mixed_echo_print' => ['use' => 'print'],
  90. 'no_multiline_whitespace_around_double_arrow' => true,
  91. 'no_null_property_initialization' => true,
  92. 'no_php4_constructor' => true,
  93. 'no_short_bool_cast' => true,
  94. 'no_short_echo_tag' => true,
  95. 'no_singleline_whitespace_before_semicolons' => true,
  96. 'no_spaces_after_function_name' => true,
  97. 'no_spaces_inside_parenthesis' => true,
  98. 'no_superfluous_elseif' => true,
  99. 'no_superfluous_phpdoc_tags' => true,
  100. 'no_trailing_comma_in_list_call' => true,
  101. 'no_trailing_comma_in_singleline_array' => true,
  102. 'no_trailing_whitespace' => true,
  103. 'no_trailing_whitespace_in_comment' => true,
  104. 'no_unneeded_control_parentheses' => true,
  105. 'no_unneeded_curly_braces' => true,
  106. 'no_unneeded_final_method' => true,
  107. 'no_unreachable_default_argument_value' => true,
  108. 'no_unset_on_property' => true,
  109. 'no_unused_imports' => true,
  110. 'no_useless_else' => true,
  111. 'no_useless_return' => true,
  112. 'no_whitespace_before_comma_in_array' => true,
  113. 'no_whitespace_in_blank_line' => true,
  114. 'non_printable_character' => true,
  115. 'normalize_index_brace' => true,
  116. 'object_operator_without_whitespace' => true,
  117. 'ordered_class_elements' => [
  118. 'order' => [
  119. 'use_trait',
  120. 'constant_public',
  121. 'constant_protected',
  122. 'constant_private',
  123. 'property_public_static',
  124. 'property_protected_static',
  125. 'property_private_static',
  126. 'property_public',
  127. 'property_protected',
  128. 'property_private',
  129. 'method_public_static',
  130. 'construct',
  131. 'destruct',
  132. 'magic',
  133. 'phpunit',
  134. 'method_public',
  135. 'method_protected',
  136. 'method_private',
  137. 'method_protected_static',
  138. 'method_private_static',
  139. ],
  140. ],
  141. 'ordered_imports' => true,
  142. 'phpdoc_add_missing_param_annotation' => true,
  143. 'phpdoc_align' => true,
  144. 'phpdoc_annotation_without_dot' => true,
  145. 'phpdoc_indent' => true,
  146. 'phpdoc_no_access' => true,
  147. 'phpdoc_no_empty_return' => true,
  148. 'phpdoc_no_package' => true,
  149. 'phpdoc_order' => true,
  150. 'phpdoc_return_self_reference' => true,
  151. 'phpdoc_scalar' => true,
  152. 'phpdoc_separation' => true,
  153. 'phpdoc_single_line_var_spacing' => true,
  154. 'phpdoc_to_comment' => true,
  155. 'phpdoc_trim' => true,
  156. 'phpdoc_trim_consecutive_blank_line_separation' => true,
  157. 'phpdoc_types' => true,
  158. 'phpdoc_types_order' => true,
  159. 'phpdoc_var_without_name' => true,
  160. 'pow_to_exponentiation' => true,
  161. 'protected_to_private' => true,
  162. 'return_assignment' => true,
  163. 'return_type_declaration' => ['space_before' => 'none'],
  164. 'self_accessor' => true,
  165. 'semicolon_after_instruction' => true,
  166. 'set_type_to_cast' => true,
  167. 'short_scalar_cast' => true,
  168. 'simplified_null_return' => true,
  169. 'single_blank_line_at_eof' => true,
  170. 'single_import_per_statement' => true,
  171. 'single_line_after_imports' => true,
  172. 'single_quote' => true,
  173. 'standardize_not_equals' => true,
  174. 'ternary_to_null_coalescing' => 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. ->in(__DIR__ . '/tests')
  187. );