説明なし

.php_cs.dist 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of php-file-iterator.
  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. 'dir_constant' => true,
  48. 'elseif' => true,
  49. 'encoding' => true,
  50. 'full_opening_tag' => true,
  51. 'function_declaration' => true,
  52. 'header_comment' => ['header' => $header, 'separate' => 'none'],
  53. 'indentation_type' => true,
  54. 'line_ending' => true,
  55. 'list_syntax' => ['syntax' => 'short'],
  56. 'lowercase_cast' => true,
  57. 'lowercase_constants' => true,
  58. 'lowercase_keywords' => true,
  59. 'magic_constant_casing' => true,
  60. 'method_argument_space' => ['ensure_fully_multiline' => true],
  61. 'modernize_types_casting' => true,
  62. 'native_function_casing' => true,
  63. 'native_function_invocation' => true,
  64. 'no_alias_functions' => true,
  65. 'no_blank_lines_after_class_opening' => true,
  66. 'no_blank_lines_after_phpdoc' => true,
  67. 'no_closing_tag' => true,
  68. 'no_empty_comment' => true,
  69. 'no_empty_phpdoc' => true,
  70. 'no_empty_statement' => true,
  71. 'no_extra_blank_lines' => true,
  72. 'no_homoglyph_names' => true,
  73. 'no_leading_import_slash' => true,
  74. 'no_leading_namespace_whitespace' => true,
  75. 'no_mixed_echo_print' => ['use' => 'print'],
  76. 'no_null_property_initialization' => true,
  77. 'no_short_bool_cast' => true,
  78. 'no_short_echo_tag' => true,
  79. 'no_singleline_whitespace_before_semicolons' => true,
  80. 'no_spaces_after_function_name' => true,
  81. 'no_spaces_inside_parenthesis' => true,
  82. 'no_superfluous_elseif' => true,
  83. 'no_trailing_comma_in_list_call' => true,
  84. 'no_trailing_comma_in_singleline_array' => true,
  85. 'no_trailing_whitespace' => true,
  86. 'no_trailing_whitespace_in_comment' => 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_whitespace_before_comma_in_array' => true,
  94. 'no_whitespace_in_blank_line' => true,
  95. 'non_printable_character' => true,
  96. 'normalize_index_brace' => true,
  97. 'object_operator_without_whitespace' => true,
  98. 'ordered_class_elements' => [
  99. 'order' => [
  100. 'use_trait',
  101. 'constant_public',
  102. 'constant_protected',
  103. 'constant_private',
  104. 'property_public_static',
  105. 'property_protected_static',
  106. 'property_private_static',
  107. 'property_public',
  108. 'property_protected',
  109. 'property_private',
  110. 'method_public_static',
  111. 'construct',
  112. 'destruct',
  113. 'magic',
  114. 'phpunit',
  115. 'method_public',
  116. 'method_protected',
  117. 'method_private',
  118. 'method_protected_static',
  119. 'method_private_static',
  120. ],
  121. ],
  122. 'ordered_imports' => true,
  123. 'phpdoc_add_missing_param_annotation' => true,
  124. 'phpdoc_align' => true,
  125. 'phpdoc_annotation_without_dot' => true,
  126. 'phpdoc_indent' => true,
  127. 'phpdoc_no_access' => true,
  128. 'phpdoc_no_empty_return' => true,
  129. 'phpdoc_no_package' => true,
  130. 'phpdoc_order' => true,
  131. 'phpdoc_return_self_reference' => true,
  132. 'phpdoc_scalar' => true,
  133. 'phpdoc_separation' => true,
  134. 'phpdoc_single_line_var_spacing' => true,
  135. 'phpdoc_to_comment' => true,
  136. 'phpdoc_trim' => true,
  137. 'phpdoc_types' => true,
  138. 'phpdoc_types_order' => true,
  139. 'phpdoc_var_without_name' => true,
  140. 'pow_to_exponentiation' => true,
  141. 'protected_to_private' => true,
  142. 'return_type_declaration' => ['space_before' => 'none'],
  143. 'self_accessor' => true,
  144. 'short_scalar_cast' => true,
  145. 'simplified_null_return' => true,
  146. 'single_blank_line_at_eof' => true,
  147. 'single_import_per_statement' => true,
  148. 'single_line_after_imports' => true,
  149. 'single_quote' => true,
  150. 'standardize_not_equals' => true,
  151. 'ternary_to_null_coalescing' => true,
  152. 'trim_array_spaces' => true,
  153. 'unary_operator_spaces' => true,
  154. 'visibility_required' => true,
  155. 'void_return' => true,
  156. 'whitespace_after_comma_in_array' => true,
  157. ]
  158. )
  159. ->setFinder(
  160. PhpCsFixer\Finder::create()
  161. ->files()
  162. ->in(__DIR__ . '/src')
  163. ->in(__DIR__ . '/tests')
  164. ->notName('*.phpt')
  165. );