.php-cs-fixer.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. $header = <<<EOF
  3. This file is part of the Monolog package.
  4. (c) Jordi Boggiano <j.boggiano@seld.be>
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. EOF;
  8. $finder = PhpCsFixer\Finder::create()
  9. ->files()
  10. ->name('*.php')
  11. ->exclude('Fixtures')
  12. ->in(__DIR__.'/src')
  13. ->in(__DIR__.'/tests')
  14. ;
  15. $config = new PhpCsFixer\Config();
  16. return $config->setRules(array(
  17. '@PSR2' => true,
  18. // some rules disabled as long as 1.x branch is maintained
  19. 'array_syntax' => ['syntax' => 'short'],
  20. 'binary_operator_spaces' => [
  21. 'default' => null,
  22. ],
  23. 'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
  24. 'cast_spaces' => ['space' => 'single'],
  25. 'header_comment' => ['header' => $header],
  26. 'include' => true,
  27. 'class_attributes_separation' => array('elements' => array('method' => 'one', 'trait_import' => 'none')),
  28. 'native_function_invocation' => true,
  29. 'no_blank_lines_after_class_opening' => true,
  30. 'no_blank_lines_after_phpdoc' => true,
  31. 'no_empty_statement' => true,
  32. 'no_extra_blank_lines' => true,
  33. 'no_leading_import_slash' => true,
  34. 'no_leading_namespace_whitespace' => true,
  35. 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
  36. 'no_trailing_comma_in_singleline_array' => true,
  37. 'no_unused_imports' => true,
  38. 'no_whitespace_in_blank_line' => true,
  39. 'object_operator_without_whitespace' => true,
  40. 'phpdoc_align' => true,
  41. 'phpdoc_indent' => true,
  42. 'phpdoc_no_access' => true,
  43. 'phpdoc_no_package' => true,
  44. 'phpdoc_order' => true,
  45. //'phpdoc_scalar' => true,
  46. 'phpdoc_trim' => true,
  47. //'phpdoc_types' => true,
  48. 'psr_autoloading' => ['dir' => 'src'],
  49. 'declare_strict_types' => true,
  50. 'single_blank_line_before_namespace' => true,
  51. 'standardize_not_equals' => true,
  52. 'ternary_operator_spaces' => true,
  53. 'trailing_comma_in_multiline' => true,
  54. ))
  55. ->setUsingCache(true)
  56. ->setRiskyAllowed(true)
  57. ->setFinder($finder)
  58. ;