protected function processSince($errorPos) { $since = $this->commentParser->getSince()->getContent(); if (!preg_match('/^\\d+\\.\\d+\\.\\d+$/Ss', $since)) { $error = '@since tag must contain software version'; $this->currentFile->addError($this->getReqPrefix($this->reqCodeEmpty) . $error, $errorPos); } }
/** * Process the since tag. * * @param int $commentStart The position in the stack where the comment started. * @param int $commentEnd The position in the stack where the comment ended. * * @return void */ protected function processSince($commentStart, $commentEnd) { $since = $this->commentParser->getSince(); if ($since !== null) { $errorPos = $commentStart + $since->getLine(); $foundTags = $this->commentParser->getTagOrders(); $index = array_keys($foundTags, 'since'); $var = array_keys($foundTags, 'var'); if (count($index) > 1) { $error = 'Only 1 @since tag is allowed in variable comment'; $this->currentFile->addError($error, $errorPos); return; } // Only check order if there is one var tag in variable comment. if (count($var) === 1 && $index[0] !== 2) { $error = 'The order of @since tag is wrong in variable comment'; $this->currentFile->addError($error, $errorPos); } $content = $since->getContent(); if (empty($content) === true) { $error = 'Version number missing for @since tag in variable comment'; $this->currentFile->addError($error, $errorPos); return; } else { if ($content !== '%release_version%') { if (preg_match('/^([0-9]+)\\.([0-9]+)\\.([0-9]+)/', $content) === 0) { $error = 'Expected version number to be in the form x.x.x in @since tag'; $this->currentFile->addError($error, $errorPos); } } } $spacing = substr_count($since->getWhitespaceBeforeContent(), ' '); if ($spacing !== 1) { $error = '@since tag indented incorrectly. '; $error .= "Expected 1 space but found {$spacing}."; $this->currentFile->addError($error, $errorPos); } } else { $error = 'Missing @since tag in variable comment'; $this->currentFile->addError($error, $commentEnd); } //end if }