Skip to content

0.6.6

Choose a tag to compare

@dereuromark dereuromark released this 06 Aug 13:43
· 2 commits to master since this release
e1c734c

Fixes

  • Calls at the very start of a file were skipped (#80, #81). Five sniffs guarded with if (!$previous) on a findPrevious() result, and index 0 - the open tag - is falsy. So <?php sizeof($x); and <?php is_null($x); were silently ignored while the same call one line lower was caught. Affected RemoveFunctionAlias, NoIsNull, DisallowFunctions (both copies) and ShortCast.

Improvements

  • Duplicate reporting removed (#80). Three constructs were each flagged by two or three rules at once. In every case the rule with the widest coverage stays and the narrower ones are silenced, so nothing stops being detected - it is reported once instead of two or three times.

    Construct Kept Silenced
    long casts SlevomatCodingStandard.PHP.TypeCast PSR12.Keywords.ShortFormTypeKeywords, PhpCollective.PHP.ShortCast.LongInvalid
    incrementer spacing Generic.WhiteSpace.IncrementDecrementSpacing ImplicitCastSpacing.WhitespaceBeforeVariable / .WhitespaceAfterVariable
    sizeof() PhpCollective.PHP.RemoveFunctionAlias the sizeof entry on Generic.PHP.ForbiddenFunctions

    Coverage went up rather than down: (double) casts were previously reported by only one of the three cast rules, and that is the one that stayed.

  • Unary minus spacing is now checked (#80). - $a had no coverage. PhpCollective.WhiteSpace.ImplicitCastSpacing already owned this shape for ! and @, so it gained T_MINUS. Detection is deliberately conservative - a minus counts as unary only when the preceding token cannot end a value, so subtraction such as __LINE__ - 1 is left alone. - -$i keeps its space, since closing it would produce a decrement.

Full Changelog: 0.6.5...0.6.6