.php_cs.dist 5.8 KB

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