data
4 years ago
lib
2 years ago
.coveralls.github-actions.yml
4 years ago
.php-cs-fixer.php
2 years ago
LICENSE
6 years ago
Makefile
2 years ago
VERSION
2 years ago
init.php
2 years ago
phpdoc.dist.xml
4 years ago
phpstan-baseline.neon
2 years ago
phpstan.neon.dist
2 years ago
update_certs.php
4 years ago
.php-cs-fixer.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | $finder = PhpCsFixer\Finder::create() |
| 4 | ->notPath('tests/TestCase.php'); |
| 5 | |
| 6 | $config = new PhpCsFixer\Config(); |
| 7 | $config->setRiskyAllowed(true); |
| 8 | $config->setRules([ |
| 9 | // Rulesets |
| 10 | '@PSR2' => true, |
| 11 | '@PhpCsFixer' => true, |
| 12 | '@PhpCsFixer:risky' => true, |
| 13 | '@PHP56Migration:risky' => true, |
| 14 | '@PHPUnit57Migration:risky' => true, |
| 15 | |
| 16 | // Additional rules |
| 17 | 'fopen_flags' => true, |
| 18 | 'linebreak_after_opening_tag' => true, |
| 19 | // This one is non-deterministic based on what environment you are running it in and what `get_defined_constants` returns. |
| 20 | 'native_constant_invocation' => false, |
| 21 | 'native_function_invocation' => [ |
| 22 | "strict" => false, |
| 23 | ], |
| 24 | |
| 25 | // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky --- |
| 26 | |
| 27 | // This is the same as the default for the @PhpCsFixer ruleset, minus |
| 28 | // the following values: ['include', 'include_once', 'require', |
| 29 | // 'require_once']. We could enable them and remove this line after |
| 30 | // updating codegen for the `init.php` file to be compliant. |
| 31 | 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'return', 'switch', 'throw', 'try']], |
| 32 | |
| 33 | // This is just prettier / easier to read. |
| 34 | 'concat_space' => ['spacing' => 'one'], |
| 35 | |
| 36 | // This causes strange ordering with codegen'd classes. We might be |
| 37 | // able to enable this if we update codegen to output class elements |
| 38 | // in the correct order. |
| 39 | 'ordered_class_elements' => false, |
| 40 | |
| 41 | // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of |
| 42 | // codegen'd classes. |
| 43 | 'phpdoc_align' => false, |
| 44 | |
| 45 | // This is a "risky" rule that causes a bug in our codebase. |
| 46 | // Specifically, in `StripeObject.updateAttributes` we construct new |
| 47 | // `StripeObject`s for metadata. We can't use `self` there because it |
| 48 | // needs to be a raw `StripeObject`. |
| 49 | 'self_accessor' => false, |
| 50 | |
| 51 | // Visibility annotations are not supported by php5.6 |
| 52 | 'visibility_required' => false, |
| 53 | |
| 54 | // Apparently "uninitialized" is distinct from "null" in some versions of PHP |
| 55 | // so I am defensively disabling this rule so as to not cause breaking changes |
| 56 | // but we can feel free to remove it in a major version (or maybe in a minor if |
| 57 | // we devote some effort into determining that it is safe) |
| 58 | 'no_null_property_initialization' => false, |
| 59 | |
| 60 | // We have to support `@return void` to satisfy Symfony deprecations helper. |
| 61 | // See https://github.com/stripe/stripe-php/pull/1230 |
| 62 | 'phpdoc_no_empty_return' => false, |
| 63 | ]); |
| 64 | $config->setFinder($finder); |
| 65 | return $config; |
| 66 |