.php_cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of qbhy/hyperf-auth.
  4. @link https://github.com/qbhy/hyperf-auth
  5. @document https://github.com/qbhy/hyperf-auth/blob/master/README.md
  6. @contact qbhy0715@qq.com
  7. @license https://github.com/qbhy/hyperf-auth/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. 'class_attributes_separation' => true,
  63. 'combine_consecutive_unsets' => true,
  64. 'declare_strict_types' => true,
  65. 'linebreak_after_opening_tag' => true,
  66. 'lowercase_constants' => 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);