1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
psalm/docs/running_psalm/issues/RedundantIdentityWithTrue.md
Grégoire Paris 26f8e5b333
Add negated identity with false case
This is the opposite of === true and works the same.
2021-07-17 03:20:23 +03:00

313 B

RedundantIdentityWithTrue

Emitted when comparing a known boolean with true and the strictBinaryOperands flag is set to true.

<?php

function returnsABool(): bool {
    return rand(1, 2) === 1;
}

if (returnsABool() === true) {
    echo "hi!";
}

if (returnsABool() !== false) {
    echo "hi!";
}