phpstan-strict-rules icon indicating copy to clipboard operation
phpstan-strict-rules copied to clipboard

Extra strict and opinionated rules for PHPStan

Results 47 phpstan-strict-rules issues
Sort by recently updated
recently updated
newest added

# Feature Request Array cast is redundant on array type. (redundant cast emit a phpstan error already) For scalar type values it wraps the value into an array - inconsistent...

Configuration was introduced for rules in https://github.com/phpstan/phpstan-strict-rules/pull/182 (cc @MartinMystikJonas) But not for PHPStan\Rules\DisallowedConstructs\DisallowedLooseComparisonRule Is there a reason ? When using bleedingEdge (for other phpstan feature) it would be nice to...

This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [phpunit/phpunit](https://phpunit.de/) ([source](https://redirect.github.com/sebastianbergmann/phpunit)) | `^9.6` -> `^11.0` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpunit%2fphpunit/11.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |...

repro: https://phpstan.org/r/1c91414c-7a03-437c-976a-95a28d07f919 and https://phpstan.org/r/e2b66886-71db-4a33-9c17-aee3c1f67b7d to improve override methods checks and make refactoring/updates safer expected result: l12 in the repro should emit phpstan error for the 1st parameter

`disallowedLooseComparison` is a nice rule and can be applicable to most of the cases, except DateTime/DateTimeImmutable Comparing these 2 using comparing operators started in PHP 5.2.2, and is documented even...

Implements #224 I've borrowed the `$treatPhpDocTypesAsCertain` logic from `UselessCastRule`. I'm ignoring `mixed` type, as that would be covered by PhpStan itself on level 9. I kept the scope small: there...

Since the variables of foreach can leak out of the foreach, some very surprising things can happen: https://3v4l.org/b90aa No error is currently reported; in fact, PHPStan is convinced that no...

### Feature request I sometimes see PR's in my organisation where a cast to `(int)` is used to silence a PhpStan error about cases where `int|null` is passed somewhere that...