Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 313 Bytes

RedundantIdentityWithTrue.md

File metadata and controls

19 lines (14 loc) · 313 Bytes

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!";
}