.php-cs-fixer.dist.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. use PhpCsFixer\Config;
  3. use PhpCsFixer\Finder;
  4. $header = <<<'EOF'
  5. This file is part of the Carbon package.
  6. (c) Brian Nesbitt <brian@nesbot.com>
  7. For the full copyright and license information, please view the LICENSE
  8. file that was distributed with this source code.
  9. EOF;
  10. $rules = [
  11. '@PSR2' => true,
  12. '@PSR12' => true,
  13. '@PHP71Migration' => true,
  14. 'array_syntax' => [
  15. 'syntax' => 'short',
  16. ],
  17. 'blank_line_after_namespace' => true,
  18. 'blank_line_before_statement' => true,
  19. 'cast_spaces' => true,
  20. 'class_definition' => false,
  21. 'concat_space' => [
  22. 'spacing' => 'none',
  23. ],
  24. 'ereg_to_preg' => true,
  25. 'general_phpdoc_tag_rename' => true,
  26. 'header_comment' => [
  27. 'comment_type' => 'PHPDoc',
  28. 'header' => $header,
  29. 'location' => 'after_declare_strict',
  30. 'separate' => 'both',
  31. ],
  32. 'is_null' => true,
  33. 'line_ending' => true,
  34. 'modernize_types_casting' => true,
  35. 'native_function_invocation' => [
  36. 'include' => ['@compiler_optimized', 'app'],
  37. ],
  38. 'no_blank_lines_after_phpdoc' => true,
  39. 'no_empty_phpdoc' => true,
  40. 'no_extra_blank_lines' => true,
  41. 'no_short_bool_cast' => true,
  42. 'no_unneeded_control_parentheses' => true,
  43. 'no_unused_imports' => true,
  44. 'no_whitespace_in_blank_line' => true,
  45. 'ordered_imports' => true,
  46. 'php_unit_method_casing' => [
  47. 'case' => 'camel_case',
  48. ],
  49. 'php_unit_test_annotation' => [
  50. 'style' => 'prefix',
  51. ],
  52. 'php_unit_test_case_static_method_calls' => [
  53. 'call_type' => 'this',
  54. ],
  55. 'phpdoc_align' => [
  56. 'align' => 'vertical',
  57. 'tags' => [
  58. 'param',
  59. 'return',
  60. 'throws',
  61. 'type',
  62. 'var',
  63. ],
  64. ],
  65. 'phpdoc_indent' => true,
  66. 'phpdoc_inline_tag_normalizer' => true,
  67. 'phpdoc_no_access' => true,
  68. 'phpdoc_no_package' => true,
  69. 'phpdoc_order' => true,
  70. 'phpdoc_scalar' => true,
  71. 'phpdoc_separation' => true,
  72. 'phpdoc_tag_type' => [
  73. 'tags' => [
  74. 'inheritdoc' => 'inline',
  75. ],
  76. ],
  77. 'phpdoc_to_comment' => true,
  78. 'phpdoc_trim' => true,
  79. 'phpdoc_types' => true,
  80. 'phpdoc_var_without_name' => true,
  81. 'self_accessor' => true,
  82. 'single_quote' => true,
  83. 'space_after_semicolon' => true,
  84. 'standardize_not_equals' => true,
  85. 'ternary_operator_spaces' => true,
  86. 'trailing_comma_in_multiline' => true,
  87. 'trim_array_spaces' => true,
  88. 'unary_operator_spaces' => true,
  89. 'yoda_style' => [
  90. 'always_move_variable' => false,
  91. 'equal' => false,
  92. 'identical' => false,
  93. 'less_and_greater' => false,
  94. ],
  95. ];
  96. return (new Config())->setRules($rules)
  97. ->setFinder(
  98. Finder::create()
  99. ->in(__DIR__)
  100. ->notPath([
  101. 'src/Carbon/Doctrine/DateTimeImmutableType.php',
  102. 'src/Carbon/Doctrine/DateTimeType.php',
  103. ])
  104. )
  105. ->setUsingCache(true)
  106. ->setRiskyAllowed(true);