/** * Process the version tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ protected function processVersion($errorPos) { /** @var PHP_CodeSniffer_CommentParser_SingleElement $version */ $version = $this->commentParser->getVersion(); if (!is_null($version)) { $content = $version->getContent(); $matches = array(); if (empty($content)) { $error = 'Content missing for @version tag in file comment'; $this->currentFile->addError($error, $errorPos, 'EmptyVersion'); } elseif (!preg_match('~(SVN|CVS|Id):~', $content)) { $error = 'Invalid version "%s" in file comment; consider "CVS: <cvs_id>" or "SVN: <svn_id>" instead'; $data = array($content); $this->currentFile->addWarning($error, $errorPos, 'InvalidVersion', $data); } } }
/** * Constructs a PHP_CodeSniffer_CommentParser_FunctionCommentParser. * * @param string $comment The comment to parse. * @param PHP_CodeSniffer_File $phpcsFile The file that this comment is in. */ public function __construct($comment, PHP_CodeSniffer_File $phpcsFile) { parent::__construct($comment, $phpcsFile); }
protected function parseTag($tag, $start, $end) { parent::parseTag($tag, $start, $end); // Save column numbers for all non-empty members $cols = array(); for ($i = $start + 1; $i < $end; $i++) { if (trim($this->words[$i]) != '') { $cols[] = $this->columnNums[$i]; } } $this->_tagColumns[$tag][] = $cols; }
/** * Constructs a PHP_CodeSniffer_CommentParser_FunctionCommentParser. * * @param string $comment The comment to parse. */ public function __construct($comment) { parent::__construct($comment); }