.php_cs 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php declare(strict_types=1);
  2. $header = <<<'EOF'
  3. This file is part of sebastian/diff.
  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. 'declare_strict_types' => true,
  23. 'elseif' => true,
  24. 'encoding' => true,
  25. 'full_opening_tag' => true,
  26. 'function_declaration' => true,
  27. 'header_comment' => ['header' => $header, 'separate' => 'none'],
  28. 'indentation_type' => true,
  29. 'line_ending' => true,
  30. 'lowercase_constants' => true,
  31. 'lowercase_keywords' => true,
  32. 'method_argument_space' => true,
  33. 'native_function_invocation' => true,
  34. 'no_alias_functions' => true,
  35. 'no_blank_lines_after_class_opening' => true,
  36. 'no_blank_lines_after_phpdoc' => true,
  37. 'no_closing_tag' => true,
  38. 'no_empty_phpdoc' => true,
  39. 'no_empty_statement' => true,
  40. 'no_extra_consecutive_blank_lines' => true,
  41. 'no_leading_namespace_whitespace' => true,
  42. 'no_singleline_whitespace_before_semicolons' => true,
  43. 'no_spaces_after_function_name' => true,
  44. 'no_spaces_inside_parenthesis' => true,
  45. 'no_trailing_comma_in_list_call' => true,
  46. 'no_trailing_whitespace' => true,
  47. 'no_unused_imports' => true,
  48. 'no_whitespace_in_blank_line' => true,
  49. 'phpdoc_align' => true,
  50. 'phpdoc_indent' => true,
  51. 'phpdoc_no_access' => true,
  52. 'phpdoc_no_empty_return' => true,
  53. 'phpdoc_no_package' => true,
  54. 'phpdoc_scalar' => true,
  55. 'phpdoc_separation' => true,
  56. 'phpdoc_to_comment' => true,
  57. 'phpdoc_trim' => true,
  58. 'phpdoc_types' => true,
  59. 'phpdoc_var_without_name' => true,
  60. 'pow_to_exponentiation' => true,
  61. 'self_accessor' => true,
  62. 'simplified_null_return' => true,
  63. 'single_blank_line_at_eof' => true,
  64. 'single_import_per_statement' => true,
  65. 'single_line_after_imports' => true,
  66. 'single_quote' => true,
  67. 'ternary_operator_spaces' => true,
  68. 'trim_array_spaces' => true,
  69. 'visibility_required' => true,
  70. ]
  71. )
  72. ->setFinder(
  73. PhpCsFixer\Finder::create()
  74. ->files()
  75. ->in(__DIR__ . '/src')
  76. ->in(__DIR__ . '/tests')
  77. ->name('*.php')
  78. );