/** * Process the author tag(s) that this header comment has. * * This function is different from other _process functions * as $authors is an array of SingleElements, so we work out * the errorPos for each element separately * * @param int $commentStart The position in the stack where * the comment started. * * @return void */ protected function processAuthors($commentStart) { $authors = $this->commentParser->getAuthors(); // Report missing return. if (empty($authors) === false) { foreach ($authors as $author) { $errorPos = $commentStart + $author->getLine(); $content = $author->getContent(); if ($content !== '') { $local = '\\da-zA-Z-_+'; // Dot character cannot be the first or last character // in the local-part. $localMiddle = $local . '.\\w'; if (preg_match('/^([^<]*)\\s+<([' . $local . '][' . $localMiddle . ']*[' . $local . ']@[\\da-zA-Z][-.\\w]*[\\da-zA-Z]\\.[a-zA-Z]{2,7})>$/', $content) === 0) { $error = 'Content of the @author tag must be in the form "Display Name <*****@*****.**>"'; $this->currentFile->addError($error, $errorPos, 'InvalidAuthors'); } } else { $error = 'Content missing for @author tag in %s comment'; $docBlock = get_class($this) === 'PEAR_Sniffs_Commenting_FileCommentSniff' ? 'file' : 'class'; $data = array($docBlock); $this->currentFile->addError($error, $errorPos, 'EmptyAuthors', $data); } } } }