phpstan / phpstan-strict-rules

Extra strict and opinionated rules for PHPStan
MIT License
592 stars 46 forks source link

Check incompatible operand values for greater/smaller operands #217

Open kamil-zacek opened 1 year ago

janedbal commented 1 year ago

Here is a more generic approach: https://github.com/shipmonk-rnd/phpstan-rules#allowcomparingonlycomparabletypes

Denies using comparison operators >,<,<=,>=,<=> over anything other than int|string|float|DateTimeInterface. Null is not allowed. Mixing different types in those operators is also forbidden, only exception is comparing floats with integers