.php-cs-fixer.dist.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. $header = <<<'EOF'
  3. This file is a part of the DiscordPHP-Http project.
  4. Copyright (c) 2021-present David Cole <david.cole1340@gmail.com>
  5. This file is subject to the MIT license that is bundled
  6. with this source code in the LICENSE file.
  7. EOF;
  8. $fixers = [
  9. 'blank_line_after_namespace',
  10. 'braces',
  11. 'class_definition',
  12. 'elseif',
  13. 'encoding',
  14. 'full_opening_tag',
  15. 'function_declaration',
  16. 'lowercase_keywords',
  17. 'method_argument_space',
  18. 'no_closing_tag',
  19. 'no_spaces_after_function_name',
  20. 'no_spaces_inside_parenthesis',
  21. 'no_trailing_whitespace',
  22. 'no_trailing_whitespace_in_comment',
  23. 'single_blank_line_at_eof',
  24. 'single_class_element_per_statement',
  25. 'single_import_per_statement',
  26. 'single_line_after_imports',
  27. 'switch_case_semicolon_to_colon',
  28. 'switch_case_space',
  29. 'visibility_required',
  30. 'blank_line_after_opening_tag',
  31. 'no_multiline_whitespace_around_double_arrow',
  32. 'no_empty_statement',
  33. 'include',
  34. 'no_trailing_comma_in_list_call',
  35. 'not_operator_with_successor_space',
  36. 'no_leading_namespace_whitespace',
  37. 'no_blank_lines_after_class_opening',
  38. 'no_blank_lines_after_phpdoc',
  39. 'object_operator_without_whitespace',
  40. 'binary_operator_spaces',
  41. 'phpdoc_indent',
  42. 'general_phpdoc_tag_rename',
  43. 'phpdoc_inline_tag_normalizer',
  44. 'phpdoc_tag_type',
  45. 'phpdoc_no_access',
  46. 'phpdoc_no_package',
  47. 'phpdoc_scalar',
  48. 'phpdoc_summary',
  49. 'phpdoc_to_comment',
  50. 'phpdoc_trim',
  51. 'phpdoc_var_without_name',
  52. 'no_leading_import_slash',
  53. 'no_trailing_comma_in_singleline_array',
  54. 'single_blank_line_before_namespace',
  55. 'single_quote',
  56. 'no_singleline_whitespace_before_semicolons',
  57. 'cast_spaces',
  58. 'standardize_not_equals',
  59. 'ternary_operator_spaces',
  60. 'trim_array_spaces',
  61. 'unary_operator_spaces',
  62. 'no_unused_imports',
  63. 'no_useless_else',
  64. 'no_useless_return',
  65. 'phpdoc_no_empty_return',
  66. 'no_extra_blank_lines',
  67. 'multiline_whitespace_before_semicolons',
  68. ];
  69. $rules = [
  70. 'concat_space' => ['spacing' => 'none'],
  71. 'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
  72. 'array_syntax' => ['syntax' => 'short'],
  73. 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
  74. 'header_comment' => ['header' => $header],
  75. 'indentation_type' => true,
  76. 'phpdoc_align' => [
  77. 'align' => 'vertical',
  78. 'tags' => ['param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var', 'method'],
  79. ],
  80. 'blank_line_before_statement' => ['statements' => ['return']],
  81. 'constant_case' => ['case' => 'lower'],
  82. 'echo_tag_syntax' => ['format' => 'long'],
  83. 'trailing_comma_in_multiline' => ['elements' => ['arrays']],
  84. ];
  85. foreach ($fixers as $fix) {
  86. $rules[$fix] = true;
  87. }
  88. $config = new PhpCsFixer\Config();
  89. return $config
  90. ->setRules($rules)
  91. ->setFinder(
  92. PhpCsFixer\Finder::create()
  93. ->in(__DIR__)
  94. );