.php_cs 2.5 KB

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