/**
  * Checks for short and long descriptions on variable definitions
  *
  * @param PHP_CodeSniffer_CommentParser_CommentElement $comment
  * @param int $commentStart
  * @return void
  */
 protected function checkForDescription($comment, $commentStart)
 {
     $short = $comment->getShortComment();
     $long = '';
     $newlineCount = 0;
     if (trim($short) === '') {
         $this->helper->addMessage($commentStart, Helper::MISSING_SHORT, ['variable']);
         $newlineCount = 1;
     } else {
         // No extra newline before short description.
         $newlineSpan = strspn($short, $this->helper->getEolChar());
         if ($short !== '' && $newlineSpan > 0) {
             $this->helper->addMessage($commentStart + 1, Helper::SPACING_BEFORE_SHORT, ['variable']);
         }
         $newlineCount = substr_count($short, $this->helper->getEolChar()) + 1;
         // Exactly one blank line between short and long description.
         $long = $comment->getLongComment();
         if (empty($long) === false) {
             $between = $comment->getWhiteSpaceBetween();
             $newlineBetween = substr_count($between, $this->helper->getEolChar());
             if ($newlineBetween !== 2) {
                 $this->helper->addMessage($commentStart + $newlineCount + 1, Helper::SPACING_BETWEEN, ['variable']);
             }
             $newlineCount += $newlineBetween;
             $testLong = trim($long);
             if (preg_match('|\\p{Lu}|u', $testLong[0]) === 0) {
                 $this->helper->addMessage($commentStart + $newlineCount, Helper::LONG_NOT_CAPITAL, ['Variable']);
             }
         }
         // Short description must be single line and end with a full stop.
         $testShort = trim($short);
         $lastChar = $testShort[strlen($testShort) - 1];
         if (substr_count($testShort, $this->helper->getEolChar()) !== 0) {
             $this->helper->addMessage($commentStart + 1, Helper::SHORT_SINGLE_LINE, ['Variable']);
         }
         if (preg_match('|\\p{Lu}|u', $testShort[0]) === 0) {
             $this->helper->addMessage($commentStart + 1, Helper::SHORT_NOT_CAPITAL, ['Variable']);
         }
         if ($lastChar !== '.') {
             $this->helper->addMessage($commentStart + 1, Helper::SHORT_FULL_STOP, ['Variable']);
         }
     }
     // Exactly one blank line before tags.
     $tags = $this->commentParser->getTagOrders();
     if (count($tags) > 1) {
         $newlineSpan = $comment->getNewlineAfter();
         if ($newlineSpan !== 2) {
             if ($long !== '') {
                 $newlineCount += substr_count($long, $this->helper->getEolChar()) - $newlineSpan + 1;
             }
             $this->helper->addMessage($commentStart + $newlineCount, Helper::SPACING_BEFORE_TAGS, ['variable']);
             $short = rtrim($short, $this->helper->getEolChar() . ' ');
         }
     }
 }