.php-cs-fixer.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of toolkit/stdlib.
  4. @author https://github.com/inhere
  5. @link https://github.com/php-toolkit/stdlib
  6. @license MIT
  7. EOF;
  8. $rules = [
  9. '@PSR2' => true,
  10. 'array_syntax' => [
  11. 'syntax' => 'short'
  12. ],
  13. 'list_syntax' => [
  14. 'syntax' => 'short'
  15. ],
  16. 'class_attributes_separation' => true,
  17. 'declare_strict_types' => true,
  18. 'global_namespace_import' => [
  19. 'import_constants' => true,
  20. 'import_functions' => true,
  21. ],
  22. 'header_comment' => [
  23. 'comment_type' => 'PHPDoc',
  24. 'header' => $header,
  25. 'separate' => 'bottom'
  26. ],
  27. 'no_unused_imports' => true,
  28. 'return_type_declaration' => [
  29. 'space_before' => 'none',
  30. ],
  31. 'single_quote' => true,
  32. 'standardize_not_equals' => true,
  33. 'void_return' => true, // add :void for method
  34. ];
  35. return (new PhpCsFixer\Config)
  36. ->setRiskyAllowed(true)
  37. ->setRules($rules)
  38. ->setFinder(
  39. PhpCsFixer\Finder::create()
  40. // ->exclude('test')
  41. ->exclude('runtime')
  42. ->exclude('vendor')
  43. ->in(__DIR__)
  44. )
  45. ->setUsingCache(false);