.php-cs-fixer.php 2.4 KB

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