Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule long_to_shorthand_operator

Shorthand notation for operators should be used if possible.


Using this rule is risky

Risky when applying for string offsets (e.g. <?php $text = "foo"; $text[0] = $text[0] & "\x7F";).


Example #1

--- Original
+++ New
-$i = $i + 10;
+$i += 10;

Rule sets

The rule is part of the following rule sets:


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