Loose equality comparison (ARCH7195)
Esta página aún no está disponible en tu idioma.
Key php.quality.loose-equality · Severity info · Category quality
In PHP the == operator coerces operands (0 == "abc" could be true in older versions), causing subtle bugs. Use the type-safe ===.
Incorrect
Section titled “Incorrect”<?phpfunction isZero($value): bool{ return $value == 0;}Correct
Section titled “Correct”<?phpfunction isZero(int $value): bool{ return $value === 0;}Always use the strict === and !== operators to avoid type coercion.