Skip to content

Commit

Permalink
Readme: add PHPStan extra strictness section
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal committed Dec 12, 2023
1 parent 0c102ce commit 8f2aadd
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ShipMonk PHPStan rules
About **30 super-strict rules** we found useful in ShipMonk.
We tend to have PHPStan set up as strict as possible ([bleedingEdge](https://phpstan.org/blog/what-is-bleeding-edge), [strict-rules](https://github.com/phpstan/phpstan-strict-rules), [checkUninitializedProperties](https://phpstan.org/config-reference#checkuninitializedproperties), ...), but that still was not strict enough for us.
About **40 super-strict rules** we found useful in ShipMonk.
We tend to have PHPStan set up as strict as possible, but that still was not strict enough for us.
This set of rules should fill the missing gaps we found.

If you find some rules opinionated, you can easily disable them.
Expand Down Expand Up @@ -776,6 +776,22 @@ class Example
}
```

## Native PHPStan extra strictness
Some strict behaviour in PHPStan is not enabled by default, consider enabling extra strictness even there:

```neon
includes:
- phar://phpstan.phar/conf/config.levelmax.neon
- phar://phpstan.phar/conf/bleedingEdge.neon # https://phpstan.org/blog/what-is-bleeding-edge
- vendor/phpstan/phpstan-strict-rules/rules.neon # https://github.com/phpstan/phpstan-strict-rules
parameters:
checkImplicitMixed: true # https://phpstan.org/config-reference#checkimplicitmixed
checkBenevolentUnionTypes: true # https://phpstan.org/config-reference#checkbenevolentuniontypes
checkUninitializedProperties: true # https://phpstan.org/config-reference#checkuninitializedproperties
checkMissingCallableSignature: true # https://phpstan.org/config-reference#vague-typehints
checkTooWideReturnTypesInProtectedAndPublicMethods: true # https://phpstan.org/config-reference#checktoowidereturntypesinprotectedandpublicmethods
```

## Contributing
- Check your code by `composer check`
- Autofix coding-style by `composer fix:cs`
Expand Down

0 comments on commit 8f2aadd

Please sign in to comment.