.php_cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. return PhpCsFixer\Config::create()
  3. ->setRules([
  4. '@PSR2' => true,
  5. 'binary_operator_spaces' => true,
  6. 'blank_line_after_opening_tag' => true,
  7. 'compact_nullable_typehint' => true,
  8. 'declare_equal_normalize' => true,
  9. 'lowercase_cast' => true,
  10. 'lowercase_static_reference' => true,
  11. 'new_with_braces' => true,
  12. 'no_blank_lines_after_class_opening' => true,
  13. 'no_leading_import_slash' => true,
  14. 'no_whitespace_in_blank_line' => true,
  15. 'no_unused_imports' => true,
  16. 'ordered_class_elements' => [
  17. 'order' => [
  18. 'use_trait',
  19. ],
  20. ],
  21. 'ordered_imports' => [
  22. 'imports_order' => [
  23. 'class',
  24. 'function',
  25. 'const',
  26. ],
  27. 'sort_algorithm' => 'none',
  28. ],
  29. 'return_type_declaration' => true,
  30. 'short_scalar_cast' => true,
  31. 'single_blank_line_before_namespace' => true,
  32. 'single_trait_insert_per_statement' => true,
  33. 'ternary_operator_spaces' => true,
  34. 'unary_operator_spaces' => true,
  35. 'visibility_required' => [
  36. 'elements' => [
  37. 'const',
  38. 'method',
  39. 'property',
  40. ],
  41. ],
  42. ])
  43. ->setFinder(
  44. PhpCsFixer\Finder::create()
  45. ->in([__DIR__.'/src', __DIR__.'/tests'])
  46. )
  47. ;