.php_cs.dist 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. return PhpCsFixer\Config::create()
  3. ->setRiskyAllowed(true)
  4. ->setRules([
  5. // Rulesets
  6. '@PSR2' => true,
  7. '@PhpCsFixer' => true,
  8. '@PhpCsFixer:risky' => true,
  9. '@PHP56Migration:risky' => true,
  10. '@PHPUnit57Migration:risky' => true,
  11. // Additional rules
  12. 'fopen_flags' => true,
  13. 'linebreak_after_opening_tag' => true,
  14. 'native_constant_invocation' => true,
  15. 'native_function_invocation' => true,
  16. // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky ---
  17. // This is the same as the default for the @PhpCsFixer ruleset, minus
  18. // the following values: ['include', 'include_once', 'require',
  19. // 'require_once']. We could enable them and remove this line after
  20. // updating codegen for the `init.php` file to be compliant.
  21. 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'return', 'switch', 'throw', 'try']],
  22. // This is just prettier / easier to read.
  23. 'concat_space' => ['spacing' => 'one'],
  24. // This causes strange ordering with codegen'd classes. We might be
  25. // able to enable this if we update codegen to output class elements
  26. // in the correct order.
  27. 'ordered_class_elements' => false,
  28. // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of
  29. // codegen'd classes.
  30. 'phpdoc_align' => false,
  31. // This is a "risky" rule that causes a bug in our codebase.
  32. // Specifically, in `StripeObject.updateAttributes` we construct new
  33. // `StripeObject`s for metadata. We can't use `self` there because it
  34. // needs to be a raw `StripeObject`.
  35. 'self_accessor' => false,
  36. ])
  37. ;