Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.57.2) edition

Rule simplified_if_return

Simplify if control structures that return the boolean result of their condition.


Example #1

--- Original
+++ New
-if ($foo) { return true; } return false;
+return (bool) ($foo)      ;


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.