.php_cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of sebastian/global-state.
  4. (c) Sebastian Bergmann <sebastian@phpunit.de>
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. EOF;
  8. return PhpCsFixer\Config::create()
  9. ->setRiskyAllowed(true)
  10. ->setRules(
  11. [
  12. 'array_syntax' => ['syntax' => 'short'],
  13. 'binary_operator_spaces' => [
  14. 'align_double_arrow' => true,
  15. 'align_equals' => true
  16. ],
  17. 'blank_line_after_namespace' => true,
  18. 'blank_line_before_return' => true,
  19. 'braces' => true,
  20. 'cast_spaces' => true,
  21. 'concat_space' => ['spacing' => 'one'],
  22. 'elseif' => true,
  23. 'encoding' => true,
  24. 'full_opening_tag' => true,
  25. 'function_declaration' => true,
  26. #'header_comment' => ['header' => $header, 'separate' => 'none'],
  27. 'indentation_type' => true,
  28. 'line_ending' => true,
  29. 'lowercase_constants' => true,
  30. 'lowercase_keywords' => true,
  31. 'method_argument_space' => true,
  32. 'native_function_invocation' => true,
  33. 'no_alias_functions' => true,
  34. 'no_blank_lines_after_class_opening' => true,
  35. 'no_blank_lines_after_phpdoc' => true,
  36. 'no_closing_tag' => true,
  37. 'no_empty_phpdoc' => true,
  38. 'no_empty_statement' => true,
  39. 'no_extra_consecutive_blank_lines' => true,
  40. 'no_leading_namespace_whitespace' => true,
  41. 'no_singleline_whitespace_before_semicolons' => true,
  42. 'no_spaces_after_function_name' => true,
  43. 'no_spaces_inside_parenthesis' => true,
  44. 'no_trailing_comma_in_list_call' => true,
  45. 'no_trailing_whitespace' => true,
  46. 'no_unused_imports' => true,
  47. 'no_whitespace_in_blank_line' => true,
  48. 'phpdoc_align' => true,
  49. 'phpdoc_indent' => true,
  50. 'phpdoc_no_access' => true,
  51. 'phpdoc_no_empty_return' => true,
  52. 'phpdoc_no_package' => true,
  53. 'phpdoc_scalar' => true,
  54. 'phpdoc_separation' => true,
  55. 'phpdoc_to_comment' => true,
  56. 'phpdoc_trim' => true,
  57. 'phpdoc_types' => true,
  58. 'phpdoc_var_without_name' => true,
  59. 'self_accessor' => true,
  60. 'simplified_null_return' => true,
  61. 'single_blank_line_at_eof' => true,
  62. 'single_import_per_statement' => true,
  63. 'single_line_after_imports' => true,
  64. 'single_quote' => true,
  65. 'ternary_operator_spaces' => true,
  66. 'trim_array_spaces' => true,
  67. 'visibility_required' => true,
  68. ]
  69. )
  70. ->setFinder(
  71. PhpCsFixer\Finder::create()
  72. ->files()
  73. ->in(__DIR__ . '/src')
  74. ->in(__DIR__ . '/tests')
  75. ->name('*.php')
  76. );