.php_cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of Hyperf.
  4. @link https://www.hyperf.io
  5. @document https://hyperf.wiki
  6. @contact group@hyperf.io
  7. @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  8. EOF;
  9. return PhpCsFixer\Config::create()
  10. ->setRiskyAllowed(true)
  11. ->setRules([
  12. '@PSR2' => true,
  13. '@Symfony' => true,
  14. '@DoctrineAnnotation' => true,
  15. '@PhpCsFixer' => true,
  16. 'header_comment' => [
  17. 'commentType' => 'PHPDoc',
  18. 'header' => $header,
  19. 'separate' => 'none',
  20. 'location' => 'after_declare_strict',
  21. ],
  22. 'array_syntax' => [
  23. 'syntax' => 'short'
  24. ],
  25. 'list_syntax' => [
  26. 'syntax' => 'short'
  27. ],
  28. 'concat_space' => [
  29. 'spacing' => 'one'
  30. ],
  31. 'blank_line_before_statement' => [
  32. 'statements' => [
  33. 'declare',
  34. ],
  35. ],
  36. 'general_phpdoc_annotation_remove' => [
  37. 'annotations' => [
  38. 'author'
  39. ],
  40. ],
  41. 'ordered_imports' => [
  42. 'imports_order' => [
  43. 'class', 'function', 'const',
  44. ],
  45. 'sort_algorithm' => 'alpha',
  46. ],
  47. 'single_line_comment_style' => [
  48. 'comment_types' => [
  49. ],
  50. ],
  51. 'yoda_style' => [
  52. 'always_move_variable' => false,
  53. 'equal' => false,
  54. 'identical' => false,
  55. ],
  56. 'phpdoc_align' => [
  57. 'align' => 'left',
  58. ],
  59. 'multiline_whitespace_before_semicolons' => [
  60. 'strategy' => 'no_multi_line',
  61. ],
  62. 'constant_case' => [
  63. 'case' => 'lower',
  64. ],
  65. 'class_attributes_separation' => true,
  66. 'combine_consecutive_unsets' => true,
  67. 'declare_strict_types' => true,
  68. 'linebreak_after_opening_tag' => true,
  69. 'lowercase_static_reference' => true,
  70. 'no_useless_else' => true,
  71. 'no_unused_imports' => true,
  72. 'not_operator_with_successor_space' => true,
  73. 'not_operator_with_space' => false,
  74. 'ordered_class_elements' => true,
  75. 'php_unit_strict' => false,
  76. 'phpdoc_separation' => false,
  77. 'single_quote' => true,
  78. 'standardize_not_equals' => true,
  79. 'multiline_comment_opening_closing' => true,
  80. ])
  81. ->setFinder(
  82. PhpCsFixer\Finder::create()
  83. ->exclude('vendor')
  84. ->in(__DIR__)
  85. )
  86. ->setUsingCache(false);