mirror of
https://github.com/danog/psalm.git
synced 2024-12-03 10:07:52 +01:00
26f8e5b333
This is the opposite of === true and works the same.
20 lines
313 B
Markdown
20 lines
313 B
Markdown
# RedundantIdentityWithTrue
|
|
|
|
Emitted when comparing a known boolean with true and the `strictBinaryOperands` flag is set to true.
|
|
|
|
```php
|
|
<?php
|
|
|
|
function returnsABool(): bool {
|
|
return rand(1, 2) === 1;
|
|
}
|
|
|
|
if (returnsABool() === true) {
|
|
echo "hi!";
|
|
}
|
|
|
|
if (returnsABool() !== false) {
|
|
echo "hi!";
|
|
}
|
|
```
|