/** * 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); } } }
/** * Process the version tag. * * @param int $errorPos The line number where the error occurs. * * @return void */ protected function processVersion($errorPos) { $version = $this->commentParser->getVersion(); if ($version !== null) { $content = $version->getContent(); $matches = array(); if (empty($content) === true) { $error = 'Content missing for @version tag in file comment'; $this->currentFile->addError($error, $errorPos, 'EmptyVersion'); } else { if (strstr($content, 'CVS:') === false && strstr($content, 'SVN:') === false && strstr($content, 'Id:') === false) { $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); } } } }
/** * Process the see tags. * * @param int $commentStart The position in the stack where the comment started. * * @return void */ protected function processSees($commentStart) { $sees = $this->commentParser->getSees(); if (empty($sees) === false) { foreach ($sees as $see) { $errorPos = $commentStart + $see->getLine(); $content = $see->getContent(); if (empty($content) === true) { $this->helper->addMessage($errorPos, M2_Sniffs_Annotations_Helper::EMPTY_SEE, ['variable']); continue; } $spacing = substr_count($see->getWhitespaceBeforeContent(), ' '); if ($spacing !== 1) { $data = [$spacing]; $this->helper->addMessage($errorPos, M2_Sniffs_Annotations_Helper::SEE_INDENT, $data); } } } }