示例#1
0
 /**
  * Process the return comment of this function comment.
  *
  * @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 processreturn($commentstart, $commentend)
 {
     // Skip constructor and destructor.
     $classname = '';
     if ($this->_classtoken !== null) {
         $classname = $this->currentfile->getdeclarationname($this->_classtoken);
         $classname = strtolower(ltrim($classname, '_'));
     }
     $methodname = strtolower(ltrim($this->_methodname, '_'));
     $isspecialmethod = $this->_methodname === '__construct' || $this->_methodname === '__destruct';
     if ($isspecialmethod === false && $methodname !== $classname) {
         // Report missing return tag.
         if ($this->commentparser->getreturn() === null) {
             $error = 'Missing @return tag in function comment';
             $this->currentfile->adderror($error, $commentend);
         } else {
             if (trim($this->commentparser->getreturn()->getrawcontent()) === '') {
                 $error = '@return tag is empty in function comment';
                 $errorpos = $commentstart + $this->commentparser->getreturn()->getline();
                 $this->currentfile->adderror($error, $errorpos);
             }
         }
     }
 }