PhpStorm
 
Get PhpStorm
You are viewing the documentation for an earlier version of PhpStorm.

Code Inspection: Condition always evaluates to 'true/false'

Last modified: 16 May 2022

Reports the conditions that are already covered by earlier conditions and thus have no effect as well as the variables that are always true (or always false) when reached.

In the following example, in case $var is an instance of the SomeClass class, then it automatically means that it is not null. As a result, the subsequent $var === null condition always resolves to true and is therefore redundant. After the quick-fix is applied, the redundant condition is removed.