.php_cs.common.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // Share common rules between non-test and test files
  3. return [
  4. '@PSR12' => true,
  5. 'blank_line_after_opening_tag' => true,
  6. 'braces' => [
  7. 'allow_single_line_anonymous_class_with_empty_body' => true,
  8. ],
  9. 'compact_nullable_typehint' => true,
  10. 'declare_equal_normalize' => true,
  11. 'lowercase_cast' => true,
  12. 'lowercase_static_reference' => true,
  13. 'new_with_braces' => true,
  14. 'no_blank_lines_after_class_opening' => true,
  15. 'no_leading_import_slash' => true,
  16. 'no_whitespace_in_blank_line' => true,
  17. 'ordered_class_elements' => [
  18. 'order' => [
  19. 'use_trait',
  20. ],
  21. ],
  22. 'ordered_imports' => [
  23. 'imports_order' => [
  24. 'class',
  25. 'function',
  26. 'const',
  27. ],
  28. 'sort_algorithm' => 'alpha',
  29. ],
  30. 'return_type_declaration' => true,
  31. 'short_scalar_cast' => true,
  32. 'single_blank_line_before_namespace' => true,
  33. 'single_trait_insert_per_statement' => true,
  34. 'ternary_operator_spaces' => true,
  35. 'visibility_required' => [
  36. 'elements' => [
  37. 'const',
  38. 'method',
  39. 'property',
  40. ],
  41. ],
  42. // Further quality-of-life improvements
  43. 'array_syntax' => [
  44. 'syntax' => 'short',
  45. ],
  46. 'concat_space' => [
  47. 'spacing' => 'one',
  48. ],
  49. 'fully_qualified_strict_types' => true,
  50. 'native_function_invocation' => [
  51. 'include' => [],
  52. 'strict' => true,
  53. ],
  54. 'no_unused_imports' => true,
  55. 'single_quote' => true,
  56. 'space_after_semicolon' => true,
  57. 'trailing_comma_in_multiline_array' => true,
  58. 'trim_array_spaces' => true,
  59. 'unary_operator_spaces' => true,
  60. 'whitespace_after_comma_in_array' => true,
  61. ];