0.6.7
Improvements
-
The reference operator is now covered by
PhpCollective.WhiteSpace.ImplicitCastSpacing(#82). That sniff already owned this shape for!,@and unary minus, so& $listjoins it rather than arriving as a separate sniff.$bad = & $list; // reported foreach ($items as & $item) {} // reported foreach ($items as $k => & $v) {} // reported function f(array & $items) {} // reported function g(& ...$args) {} // reported $ok = &$list; // untouched $okBitwise = $a & $b; // untouched function h(int $x = self::A & self::B) {} // untouched
Telling a reference from a bitwise and takes more than the preceding token, since a type hint precedes the marker in function f(array & $items) and reads exactly like a left operand. A reference is one that stands in front of a variable, or the ellipsis of a by-reference variadic, and either follows something that cannot end a value or sits in a parameter list.
Full Changelog: 0.6.6...0.6.7