aik099 / CodingStandard

The PHP_CodeSniffer coding standard I'm using on all of my projects
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Report @var comment after var as error #85

Closed aik099 closed 8 years ago

aik099 commented 8 years ago

Plan

  1. look for single-line DocBlocks containing @var
  2. get previous non-whitespace token
  3. if it's not scope changing token (e.g. {) then it must be 1+ line before the comment itself
  4. add 1 empty line above token (keep in mind indentation)

This should auto-fix cases, when several variables are grouped together with their DocBlocks.

Example code:

/** @var kDBItem $object */
$object =& $this->getObject($params);
/** @var OrderHelper $order_helper */
$order_helper =& $this->Application->recallObject('OrderHelper');
aik099 commented 8 years ago

Closed via 1f549f3a966fb95ed3716222a7e349c341dda9eb.