Fork me on GitHub
a Sensio Labs Product

Jump & Run (v3.28.0) edition

Rule set_type_to_cast

Cast shall be used, not settype.


Using this rule is risky

Risky when the settype function is overridden or when used as the 2nd or 3rd expression in a for loop .


Example #1

--- Original
+++ New
-settype($foo, "integer");
-settype($bar, "string");
-settype($bar, "null");
+$foo = (int) $foo;
+$bar = (string) $bar;
+$bar = null;

Rule sets

The rule is part of the following rule sets:

The logo is © 2010-2022 Sensio Labs