phpstan-strict-rules
phpstan-strict-rules copied to clipboard
Extra strict and opinionated rules for PHPStan
Hello, Often I want to prepare a package for my colleagues that defines very strict rules about the expectation of what input strings a method argument or property can handle....
Hello, I think the `preg_match()` function should not be used instead of the native `str_*` functions (PHP 8+). Example: ```php if (preg_match('/\.\./', $path) === 1) { // bad, better is...
Hi! As you can se there is a false positive issue in the link: https://phpstan.org/r/4a61f25b-34eb-4935-a054-868192f50aea ps: if you know a better way to check if an array is already sorted...
https://phpstan.org/r/50a1171b-7243-4e7d-a9d4-9d0b21cc1d02 "Call to function array_key_exists() with non-empty-string and array will always evaluate to true." I disabled the following error message using checkMissingIterableValueType: false: "Function foo() has parameter $arr with no...
If you replace $that by $this in the closure of the following, the test will fail. At runtime, the type of $this is \Prophecy\Prophecy\ObjectProphecy and the type of $that is...
In Laravel we have `Request->validate()` and `Request::validate()` too. `DynamicCallOnStaticMethodsRule` emit an error when it sees `Request->validate()`. Could you add one more `if`-s?
https://phpstan.org/r/e3b1da08-3844-4f2a-ac58-a6514af25849 `and` is used, but the error message shows `&&`. Similar problem for `or` and `||`.
Hi ;) As `!` don't care about the type, it should be disallowed by `phpstan/strict-rules` no?
# Feature request When using bool values as array keys, then these keys are implicitly casted to integers. This will cause problems when a strict comparison `===` is applied on...
Hi, I have `Treat PHPDoc types as certain` option turned off, and the following piece of code fails: https://phpstan.org/r/5dd76406-fbfc-4134-8158-c859505a05fc Disabling `checkAlwaysTrueCheckTypeFunctionCall` option, actually removes the error message, but that doesn't...