.php_cs.dist 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. $config = PhpCsFixer\Config::create()
  3. ->setRiskyAllowed(true)
  4. ->setRules([
  5. '@PSR2' => true,
  6. 'array_syntax' => ['syntax' => 'short'],
  7. 'binary_operator_spaces' => ['operators' => ['=>' => null]],
  8. 'blank_line_after_opening_tag' => true,
  9. 'class_attributes_separation' => ['elements' => ['method']],
  10. 'compact_nullable_typehint' => true,
  11. 'concat_space' => ['spacing' => 'one'],
  12. 'declare_equal_normalize' => ['space' => 'none'],
  13. 'declare_strict_types' => false,
  14. 'dir_constant' => true,
  15. 'final_static_access' => true,
  16. 'fully_qualified_strict_types' => true,
  17. 'function_to_constant' => true,
  18. 'function_typehint_space' => true,
  19. 'header_comment' => false,
  20. 'is_null' => ['use_yoda_style' => false],
  21. 'list_syntax' => ['syntax' => 'short'],
  22. 'lowercase_cast' => true,
  23. 'magic_method_casing' => true,
  24. 'modernize_types_casting' => true,
  25. 'multiline_comment_opening_closing' => true,
  26. //'native_constant_invocation' => true,
  27. 'no_alias_functions' => true,
  28. 'no_alternative_syntax' => true,
  29. 'no_blank_lines_after_phpdoc' => true,
  30. 'no_empty_comment' => true,
  31. 'no_empty_phpdoc' => true,
  32. 'no_extra_blank_lines' => true,
  33. 'no_leading_import_slash' => true,
  34. 'no_leading_namespace_whitespace' => true,
  35. 'no_spaces_around_offset' => true,
  36. 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
  37. 'no_trailing_comma_in_singleline_array' => true,
  38. 'no_unneeded_control_parentheses' => true,
  39. 'no_unset_cast' => true,
  40. 'no_unused_imports' => true,
  41. 'no_useless_else' => true,
  42. 'no_useless_return' => true,
  43. 'no_whitespace_in_blank_line' => true,
  44. 'normalize_index_brace' => true,
  45. 'ordered_imports' => true,
  46. 'php_unit_construct' => true,
  47. 'php_unit_dedicate_assert' => ['target' => 'newest'],
  48. 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
  49. 'php_unit_expectation' => ['target' => 'newest'],
  50. 'php_unit_mock' => ['target' => 'newest'],
  51. 'php_unit_mock_short_will_return' => true,
  52. 'php_unit_no_expectation_annotation' => ['target' => 'newest'],
  53. 'php_unit_test_annotation' => ['style' => 'prefix'],
  54. //'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
  55. 'phpdoc_align' => ['align' => 'vertical'],
  56. //'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'],
  57. 'phpdoc_no_package' => true,
  58. 'phpdoc_no_useless_inheritdoc' => true,
  59. 'phpdoc_scalar' => true,
  60. 'phpdoc_separation' => true,
  61. 'phpdoc_single_line_var_spacing' => true,
  62. 'phpdoc_trim' => true,
  63. 'phpdoc_trim_consecutive_blank_line_separation' => true,
  64. 'phpdoc_types' => true,
  65. 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
  66. 'phpdoc_var_without_name' => true,
  67. 'return_assignment' => true,
  68. 'short_scalar_cast' => true,
  69. 'single_trait_insert_per_statement' => true,
  70. 'standardize_not_equals' => true,
  71. //'static_lambda' => true,
  72. 'ternary_to_null_coalescing' => true,
  73. 'trim_array_spaces' => true,
  74. 'visibility_required' => true,
  75. 'yoda_style' => false,
  76. // 'native_function_invocation' => true,
  77. 'braces' => ['allow_single_line_closure'=>true],
  78. ])
  79. ->setFinder(
  80. PhpCsFixer\Finder::create()
  81. ->in(__DIR__.'/src')
  82. ->in(__DIR__.'/tests')
  83. ->name('*.php')
  84. )
  85. ;
  86. return $config;