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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. $header = <<<'EOF'
  3. This file is a part of the DiscordPHP project.
  4. Copyright (c) 2015-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.md 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_trim',
  50. 'phpdoc_var_without_name',
  51. 'no_leading_import_slash',
  52. 'no_trailing_comma_in_singleline_array',
  53. 'single_blank_line_before_namespace',
  54. 'single_quote',
  55. 'no_singleline_whitespace_before_semicolons',
  56. 'cast_spaces',
  57. 'standardize_not_equals',
  58. 'ternary_operator_spaces',
  59. 'trim_array_spaces',
  60. 'unary_operator_spaces',
  61. 'no_unused_imports',
  62. 'no_useless_else',
  63. 'no_useless_return',
  64. 'phpdoc_no_empty_return',
  65. 'no_extra_blank_lines',
  66. 'multiline_whitespace_before_semicolons',
  67. ];
  68. $rules = [
  69. 'concat_space' => ['spacing' => 'none'],
  70. 'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
  71. 'array_syntax' => ['syntax' => 'short'],
  72. 'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
  73. 'header_comment' => ['header' => $header],
  74. 'indentation_type' => true,
  75. 'phpdoc_align' => [
  76. 'align' => 'vertical',
  77. 'tags' => ['param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var', 'method'],
  78. ],
  79. 'blank_line_before_statement' => ['statements' => ['return']],
  80. 'constant_case' => ['case' => 'lower'],
  81. 'echo_tag_syntax' => ['format' => 'long'],
  82. 'trailing_comma_in_multiline' => ['elements' => ['arrays']],
  83. ];
  84. foreach ($fixers as $fix) {
  85. $rules[$fix] = true;
  86. }
  87. $config = new PhpCsFixer\Config();
  88. return $config
  89. ->setRules($rules)
  90. ->setFinder(
  91. PhpCsFixer\Finder::create()
  92. ->exclude('examples')
  93. ->in(__DIR__)
  94. );