PhpStorm 2021.1 Help

Code Inspection: Redundant 'if' statement

Reports if statements which can be simplified to single assignment or return statements. For example:

if (foo()) { return true; } else { return false; } (foo()) { if (foo()) { return true; } else { return false; } true; } if (foo()) { return true; } else { return false; } { if (foo()) { return true; } else { return false; } false; }
can be simplified to
return foo(); foo();

Last modified: 08 March 2021