.php_cs.dist 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php declare(strict_types=1);
  2. $header = <<<'EOF'
  3. This file is part of sebastian/diff.
  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. 'array_syntax' => ['syntax' => 'short'],
  13. 'binary_operator_spaces' => [
  14. 'operators' => [
  15. '=' => 'align',
  16. '=>' => 'align',
  17. ],
  18. ],
  19. 'blank_line_after_namespace' => true,
  20. 'blank_line_before_statement' => [
  21. 'statements' => [
  22. 'break',
  23. 'continue',
  24. 'declare',
  25. 'do',
  26. 'for',
  27. 'foreach',
  28. 'if',
  29. 'include',
  30. 'include_once',
  31. 'require',
  32. 'require_once',
  33. 'return',
  34. 'switch',
  35. 'throw',
  36. 'try',
  37. 'while',
  38. 'yield',
  39. ],
  40. ],
  41. 'braces' => true,
  42. 'cast_spaces' => true,
  43. 'class_attributes_separation' => ['elements' => ['method']],
  44. 'compact_nullable_typehint' => true,
  45. 'concat_space' => ['spacing' => 'one'],
  46. 'declare_equal_normalize' => ['space' => 'none'],
  47. 'declare_strict_types' => true,
  48. 'dir_constant' => true,
  49. 'elseif' => true,
  50. 'encoding' => true,
  51. 'full_opening_tag' => true,
  52. 'function_declaration' => true,
  53. 'header_comment' => ['header' => $header, 'separate' => 'none'],
  54. 'indentation_type' => true,
  55. 'line_ending' => true,
  56. 'list_syntax' => ['syntax' => 'short'],
  57. 'lowercase_cast' => true,
  58. 'lowercase_constants' => true,
  59. 'lowercase_keywords' => true,
  60. 'magic_constant_casing' => true,
  61. 'method_argument_space' => ['ensure_fully_multiline' => true],
  62. 'modernize_types_casting' => true,
  63. 'native_function_casing' => true,
  64. 'native_function_invocation' => true,
  65. 'no_alias_functions' => true,
  66. 'no_blank_lines_after_class_opening' => true,
  67. 'no_blank_lines_after_phpdoc' => true,
  68. 'no_closing_tag' => true,
  69. 'no_empty_comment' => true,
  70. 'no_empty_phpdoc' => true,
  71. 'no_empty_statement' => true,
  72. 'no_extra_blank_lines' => true,
  73. 'no_homoglyph_names' => true,
  74. 'no_leading_import_slash' => true,
  75. 'no_leading_namespace_whitespace' => true,
  76. 'no_mixed_echo_print' => ['use' => 'print'],
  77. 'no_null_property_initialization' => true,
  78. 'no_short_bool_cast' => true,
  79. 'no_short_echo_tag' => true,
  80. 'no_singleline_whitespace_before_semicolons' => true,
  81. 'no_spaces_after_function_name' => true,
  82. 'no_spaces_inside_parenthesis' => true,
  83. 'no_superfluous_elseif' => true,
  84. 'no_trailing_comma_in_list_call' => true,
  85. 'no_trailing_comma_in_singleline_array' => true,
  86. 'no_trailing_whitespace' => true,
  87. 'no_trailing_whitespace_in_comment' => true,
  88. 'no_unneeded_control_parentheses' => true,
  89. 'no_unneeded_curly_braces' => true,
  90. 'no_unneeded_final_method' => true,
  91. 'no_unreachable_default_argument_value' => true,
  92. 'no_unused_imports' => true,
  93. 'no_useless_else' => true,
  94. 'no_whitespace_before_comma_in_array' => true,
  95. 'no_whitespace_in_blank_line' => true,
  96. 'non_printable_character' => true,
  97. 'normalize_index_brace' => true,
  98. 'object_operator_without_whitespace' => true,
  99. 'ordered_class_elements' => [
  100. 'order' => [
  101. 'use_trait',
  102. 'constant_public',
  103. 'constant_protected',
  104. 'constant_private',
  105. 'property_public_static',
  106. 'property_protected_static',
  107. 'property_private_static',
  108. 'property_public',
  109. 'property_protected',
  110. 'property_private',
  111. 'method_public_static',
  112. 'construct',
  113. 'destruct',
  114. 'magic',
  115. 'phpunit',
  116. 'method_public',
  117. 'method_protected',
  118. 'method_private',
  119. 'method_protected_static',
  120. 'method_private_static',
  121. ],
  122. ],
  123. 'ordered_imports' => true,
  124. 'phpdoc_add_missing_param_annotation' => true,
  125. 'phpdoc_align' => true,
  126. 'phpdoc_annotation_without_dot' => true,
  127. 'phpdoc_indent' => true,
  128. 'phpdoc_no_access' => true,
  129. 'phpdoc_no_empty_return' => true,
  130. 'phpdoc_no_package' => true,
  131. 'phpdoc_order' => true,
  132. 'phpdoc_return_self_reference' => true,
  133. 'phpdoc_scalar' => true,
  134. 'phpdoc_separation' => true,
  135. 'phpdoc_single_line_var_spacing' => true,
  136. 'phpdoc_to_comment' => true,
  137. 'phpdoc_trim' => true,
  138. 'phpdoc_types' => true,
  139. 'phpdoc_types_order' => true,
  140. 'phpdoc_var_without_name' => true,
  141. 'pow_to_exponentiation' => true,
  142. 'protected_to_private' => true,
  143. 'return_type_declaration' => ['space_before' => 'none'],
  144. 'self_accessor' => true,
  145. 'short_scalar_cast' => true,
  146. 'simplified_null_return' => true,
  147. 'single_blank_line_at_eof' => true,
  148. 'single_import_per_statement' => true,
  149. 'single_line_after_imports' => true,
  150. 'single_quote' => true,
  151. 'standardize_not_equals' => true,
  152. 'ternary_to_null_coalescing' => true,
  153. 'trim_array_spaces' => true,
  154. 'unary_operator_spaces' => true,
  155. 'visibility_required' => true,
  156. 'void_return' => true,
  157. 'whitespace_after_comma_in_array' => true,
  158. ]
  159. )
  160. ->setFinder(
  161. PhpCsFixer\Finder::create()
  162. ->files()
  163. ->in(__DIR__ . '/src')
  164. ->in(__DIR__ . '/tests')
  165. );