.php-cs-fixer.dist.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. $finder = Symfony\Component\Finder\Finder::create()
  3. ->in([
  4. __DIR__ . '/src'
  5. ])
  6. ->name('*.php')
  7. ->ignoreDotFiles(true)
  8. ;
  9. return (new PhpCsFixer\Config())
  10. ->setRules([
  11. '@PSR12' => true,
  12. '@PSR2' => true,
  13. '@DoctrineAnnotation' => true,
  14. '@Symfony' => true,
  15. '@Symfony:risky' => true,
  16. 'array_syntax' => ['syntax' => 'short'],
  17. 'array_indentation' => true,
  18. 'trim_array_spaces' => true,
  19. 'ordered_imports' => ['sort_algorithm' => 'alpha'],
  20. 'no_unused_imports' => true,
  21. 'not_operator_with_successor_space' => true,
  22. 'trailing_comma_in_multiline' => true,
  23. 'phpdoc_scalar' => true,
  24. 'unary_operator_spaces' => true,
  25. 'binary_operator_spaces' => true,
  26. 'blank_line_before_statement' => [
  27. 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
  28. ],
  29. 'phpdoc_single_line_var_spacing' => true,
  30. 'phpdoc_var_without_name' => true,
  31. 'class_attributes_separation' => [
  32. 'elements' => ['const' => 'one','method' => 'one','property' => 'one'],
  33. ],
  34. 'method_argument_space' => [
  35. 'on_multiline' => 'ensure_fully_multiline',
  36. 'keep_multiple_spaces_after_comma' => true,
  37. ],
  38. 'single_trait_insert_per_statement' => true,
  39. 'modernize_types_casting' => false, // PHPStan...*
  40. 'phpdoc_to_comment' => false, // see here to add use to structural element https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/402b34d4ab33146eaab0f17d60c928eaa7e332b9/src/Tokenizer/Analyzer/CommentsAnalyzer.php#L155
  41. ])
  42. ->setRiskyAllowed(true)
  43. ->setFinder($finder);