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

Deal with @access tags #50

Open aik099 opened 9 years ago

aik099 commented 9 years ago

DocBlock:

/**
 * Allows to override standard permission mapping
 *
 * @return void
 * @access protected
 * @see    kEventHandler::$permMapping
 */
protected function mapPermissions()

Following scenarios (for reporting) are possible:

  1. no @access tag present - do nothing
  2. @access tag present, but doesn't match method/property visibility (consider missing visibility as public) - report mismatch

Fixing scenarios:

  1. if method/property visibility not explicitly set, then set method/property visibility based on @access tag and remove @access tag
  2. if method/property visibility set and matches the @access tag, then remove @access tag
aik099 commented 8 years ago

In https://github.com/squizlabs/PHP_CodeSniffer/blob/f894e7e16009000af0db0d9951d91ba90d5f1796/CodeSniffer/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php#L96 sniff it can be seen how mass-process tags in a DocBlock.