.php_cs.dist 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. $config = new PhpCsFixer\Config('default');
  3. $config->setRiskyAllowed(true);
  4. $config->setRules([
  5. '@PSR2' => true,
  6. 'align_multiline_comment' => true,
  7. 'array_indentation' => true,
  8. 'array_syntax' => [
  9. 'syntax' => 'short',
  10. ],
  11. 'binary_operator_spaces' => [
  12. 'align_double_arrow' => false,
  13. 'align_equals' => false,
  14. ],
  15. 'blank_line_after_namespace' => true,
  16. 'blank_line_after_opening_tag' => true,
  17. 'blank_line_before_statement' => [
  18. 'statements' => [
  19. 'return',
  20. ],
  21. ],
  22. 'cast_spaces' => [
  23. 'space' => 'single',
  24. ],
  25. 'class_attributes_separation' => [
  26. 'elements' => [
  27. 'method' => 'one',
  28. 'property' => 'one',
  29. ],
  30. ],
  31. 'compact_nullable_typehint' => true,
  32. 'concat_space' => [
  33. 'spacing' => 'one',
  34. ],
  35. 'declare_equal_normalize' => true,
  36. 'declare_strict_types' => true,
  37. 'function_typehint_space' => true,
  38. 'include' => true,
  39. 'indentation_type' => true,
  40. 'lowercase_cast' => true,
  41. 'method_chaining_indentation' => true,
  42. 'method_separation' => true,
  43. 'multiline_comment_opening_closing' => true,
  44. 'native_function_casing' => true,
  45. 'new_with_braces' => true,
  46. 'no_blank_lines_after_phpdoc' => true,
  47. 'no_empty_comment' => true,
  48. 'no_empty_phpdoc' => true,
  49. 'no_empty_statement' => true,
  50. 'no_extra_consecutive_blank_lines' => [
  51. 'tokens' => [
  52. 'curly_brace_block',
  53. 'extra',
  54. 'parenthesis_brace_block',
  55. 'square_brace_block',
  56. 'throw',
  57. 'use',
  58. ],
  59. ],
  60. 'no_leading_import_slash' => true,
  61. 'no_leading_namespace_whitespace' => true,
  62. 'no_mixed_echo_print' => [
  63. 'use' => 'echo',
  64. ],
  65. 'no_multiline_whitespace_around_double_arrow' => true,
  66. 'no_short_bool_cast' => true,
  67. 'no_singleline_whitespace_before_semicolons' => true,
  68. 'no_spaces_around_offset' => true,
  69. 'no_superfluous_phpdoc_tags' => [
  70. 'allow_mixed' => true,
  71. ],
  72. 'no_trailing_comma_in_list_call' => true,
  73. 'no_trailing_comma_in_singleline_array' => true,
  74. 'no_unneeded_control_parentheses' => true,
  75. 'no_unused_imports' => true,
  76. 'no_whitespace_before_comma_in_array' => true,
  77. 'no_whitespace_in_blank_line' => true,
  78. 'not_operator_with_successor_space' => true,
  79. 'normalize_index_brace' => true,
  80. 'object_operator_without_whitespace' => true,
  81. 'ordered_imports' => true,
  82. 'phpdoc_align' => false,
  83. 'phpdoc_annotation_without_dot' => true,
  84. 'phpdoc_indent' => true,
  85. 'phpdoc_no_package' => true,
  86. 'phpdoc_no_useless_inheritdoc' => true,
  87. 'phpdoc_order' => true,
  88. 'phpdoc_scalar' => true,
  89. 'phpdoc_separation' => true,
  90. 'phpdoc_single_line_var_spacing' => true,
  91. 'phpdoc_to_comment' => true,
  92. 'phpdoc_trim' => true,
  93. 'phpdoc_trim_consecutive_blank_line_separation' => true,
  94. 'phpdoc_types' => true,
  95. 'phpdoc_var_without_name' => true,
  96. 'pre_increment' => true,
  97. 'psr4' => true,
  98. 'return_type_declaration' => true,
  99. 'short_scalar_cast' => true,
  100. 'single_blank_line_before_namespace' => true,
  101. 'single_class_element_per_statement' => true,
  102. 'single_quote' => true,
  103. 'space_after_semicolon' => true,
  104. 'standardize_not_equals' => true,
  105. 'ternary_operator_spaces' => true,
  106. 'ternary_to_null_coalescing' => true,
  107. 'trailing_comma_in_multiline_array' => true,
  108. 'trim_array_spaces' => true,
  109. 'unary_operator_spaces' => true,
  110. 'whitespace_after_comma_in_array' => true,
  111. ]);
  112. $finder = PhpCsFixer\Finder::create();
  113. $finder->in(__DIR__);
  114. $config->setFinder($finder);
  115. return $config;