cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting ClassCommentSniff.php FileCommentSniff.php FunctionCommentSniff.php
/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting ClassCommentUnitTest.inc ClassCommentUnitTest.php FunctionCommentUnitTest.inc
FunctionCommentUnitTest.php

From: Date: Wed, 24 Jan 2007 22:21:16 +0000
Subject: cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting ClassCommentSniff.php FileCommentSniff.php FunctionCommentSniff.php
/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting ClassCommentUnitTest.inc ClassCommentUnitTest.php FunctionCommentUnitTest.inc
FunctionCommentUnitTest.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44374@lists.php.net to get a copy of this message
squiz Wed Jan 24 22:21:16 2007 UTC Modified files: /pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting ClassCommentSniff.php FileCommentSniff.php FunctionCommentSniff.php /pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting ClassCommentUnitTest.inc ClassCommentUnitTest.php FunctionCommentUnitTest.inc FunctionCommentUnitTest.php Log: Coding standard changes and enhancement to the parsing of comment

http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php?r1=1.8&r2=1.9&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php:1.8 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php:1.9 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php:1.8 Fri Jan 12 03:49:53 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php Wed Jan 24 22:21:15 2007 @@ -10,7 +10,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: ClassCommentSniff.php,v 1.8 2007/01/12 03:49:53 squiz Exp $ + * @version CVS: $Id: ClassCommentSniff.php,v 1.9 2007/01/24 22:21:15 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -89,6 +89,30 @@ } $commentStart = ($phpcsFile->findPrevious(T_DOC_COMMENT, ($commentEnd - 1), null, true) + 1); + $commentNext = $phpcsFile->findPrevious(T_WHITESPACE, ($commentEnd + 1), $stackPtr, false, "\n"); + + // Distinguish file and class comment. + $prevClassToken = $phpcsFile->findPrevious(T_CLASS, ($stackPtr - 1)); + if ($prevClassToken === false) { + // This is the first class token in this file, need extra checks. + $prevNonComment = $phpcsFile->findPrevious(T_DOC_COMMENT, ($commentStart - 1), null, true); + if ($prevNonComment !== false) { + $prevComment = $phpcsFile->findPrevious(T_DOC_COMMENT, ($prevNonComment - 1)); + if ($prevComment === false) { + // There is only 1 doc comment between open tag and class token. + $newlineToken = $phpcsFile->findNext(T_WHITESPACE, ($commentEnd + 1), $stackPtr, false, "\n"); + if ($newlineToken !== false) { + $newlineToken = $phpcsFile->findNext(T_WHITESPACE, ($newlineToken +1), $stackPtr, false, "\n"); + if ($newlineToken !== false) { + // Blank line between the class and the doc block. + // The doc block is most likely a file comment. + $phpcsFile->addError('Missing class doc comment', ($stackPtr + 1)); + return; + } + }//end if + }//end if + }//end if + }//end if $comment = $phpcsFile->getTokensAsString($commentStart, ($commentEnd - $commentStart + 1)); @@ -122,31 +146,37 @@ $newlineCount = (substr_count($short, "\n") + 1); // Exactly one blank line between short and long description. - $between = $comment->getWhiteSpaceBetween(); - $long = $comment->getLongComment(); - $newlineBetween = substr_count($between, "\n"); - if ($newlineBetween !== 2 && $long !== '') { - $error = 'There must be exactly one blank line between descriptions in class comment'; - $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); - } + $long = $comment->getLongComment(); + if (empty($long) === false) { + $between = $comment->getWhiteSpaceBetween(); + $newlineBetween = substr_count($between, "\n"); + if ($newlineBetween !== 2) { + $error = 'There must be exactly one blank line between descriptions in class comment'; + $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); + } - $newlineCount += $newlineBetween; + $newlineCount += $newlineBetween; + } // Exactly one blank line before tags. - $newlineSpan = $comment->getNewlineAfter(); - if ($newlineSpan !== 2) { - $error = 'There must be exactly one blank line before the tags in class comment'; - if ($long !== '') { - $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); - } + $tags = $this->commentParser->getTagOrders(); + if (count($tags) > 1) { + $newlineSpan = $comment->getNewlineAfter(); + if ($newlineSpan !== 2) { + $error = 'There must be exactly one blank line before the tags in file comment'; + if ($long !== '') { + $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); + } - $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $short = rtrim($short, "\n "); + } } // Check for unknown/deprecated tags. $unknownTags = $this->commentParser->getUnknown(); foreach ($unknownTags as $errorTag) { - $error = ucfirst($errorTag['tag']).' tag is not allowed in class comment'; + $error = "@$errorTag[tag] tag is not allowed in class comment"; $phpcsFile->addWarning($error, ($commentStart + $errorTag['line'])); } @@ -170,7 +200,7 @@ $content = $version->getContent(); $matches = array(); if (empty($content) === true) { - $error = 'Content missing for version tag in class comment'; + $error = 'Content missing for @version tag in class comment'; $this->currentFile->addError($error, $errorPos); } else if ((strstr($content, 'Release:') === false)) { $error = "Invalid version \"$content\" in class comment; Consider \"Release: <package_version>\" instead."; http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php?r1=1.12&r2=1.13&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.12 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.13 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.12 Fri Jan 12 03:49:53 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php Wed Jan 24 22:21:15 2007 @@ -10,7 +10,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: FileCommentSniff.php,v 1.12 2007/01/12 03:49:53 squiz Exp $ + * @version CVS: $Id: FileCommentSniff.php,v 1.13 2007/01/24 22:21:15 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -116,7 +116,29 @@ // Extract the header comment docblock. $commentEnd = ($phpcsFile->findNext(T_DOC_COMMENT, ($commentStart + 1), null, true) - 1); - $comment = $phpcsFile->getTokensAsString($commentStart, ($commentEnd - $commentStart + 1)); + + // Check if there is only 1 doc comment between the open tag and class token. + $nextToken = array( + T_ABSTRACT, + T_CLASS, + T_DOC_COMMENT, + ); + $commentNext = $phpcsFile->findNext($nextToken, ($commentEnd + 1)); + if ($commentNext !== false && $tokens[$commentNext]['code'] !== T_DOC_COMMENT) { + // Found a class token right after comment doc block. + $newlineToken = $phpcsFile->findNext(T_WHITESPACE, ($commentEnd + 1), $commentNext, false, "\n"); + if ($newlineToken !== false) { + $newlineToken = $phpcsFile->findNext(T_WHITESPACE, ($newlineToken +1), $commentNext, false, "\n"); + if ($newlineToken === false) { + // No blank line between the class token and the doc block. + // The doc block is most likely a class comment. + $phpcsFile->addError('Missing file doc comment', ($stackPtr + 1)); + return; + } + } + } + + $comment = $phpcsFile->getTokensAsString($commentStart, ($commentEnd - $commentStart + 1)); // Parse the header comment docblock. try { @@ -148,31 +170,37 @@ $newlineCount = (substr_count($short, "\n") + 1); // Exactly one blank line between short and long description. - $between = $comment->getWhiteSpaceBetween(); - $long = $comment->getLongComment(); - $newlineBetween = substr_count($between, "\n"); - if ($newlineBetween !== 2 && $long !== '') { - $error = 'There must be exactly one blank line between descriptions in file comment'; - $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); - } + $long = $comment->getLongComment(); + if (empty($long) === false) { + $between = $comment->getWhiteSpaceBetween(); + $newlineBetween = substr_count($between, "\n"); + if ($newlineBetween !== 2) { + $error = 'There must be exactly one blank line between descriptions in file comment'; + $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); + } - $newlineCount += $newlineBetween; + $newlineCount += $newlineBetween; + } // Exactly one blank line before tags. - $newlineSpan = $comment->getNewlineAfter(); - if ($newlineSpan !== 2) { - $error = 'There must be exactly one blank line before the tags in file comment'; - if ($long !== '') { - $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); - } + $tags = $this->commentParser->getTagOrders(); + if (count($tags) > 1) { + $newlineSpan = $comment->getNewlineAfter(); + if ($newlineSpan !== 2) { + $error = 'There must be exactly one blank line before the tags in file comment'; + if ($long !== '') { + $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); + } - $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $short = rtrim($short, "\n "); + } } // Check for unknown/deprecated tags. $unknownTags = $this->commentParser->getUnknown(); foreach ($unknownTags as $errorTag) { - $error = ucfirst($errorTag['tag']).' tag is not allowed in file comment'; + $error = "@$errorTag[tag] tag is not allowed in file comment"; $phpcsFile->addWarning($error, ($commentStart + $errorTag['line'])); } @@ -254,7 +282,7 @@ // Required tag missing. if ($info['required'] === true && in_array($tag, $foundTags) === false) { - $error = "Missing $tag tag in $docBlock comment"; + $error = "Missing @$tag tag in $docBlock comment"; $this->currentFile->addError($error, $commentEnd); continue; } @@ -282,7 +310,7 @@ if (count($foundIndexes) > 1) { // Multiple occurance not allowed. if ($info['allow_multiple'] === false) { - $error = "Only one $tag tag is allowed in $docBlock comment"; + $error = "Only 1 @$tag tag is allowed in $docBlock comment"; $this->currentFile->addError($error, $errorPos); } else { // Make sure same tags are grouped together. @@ -291,7 +319,7 @@ foreach ($foundIndexes as $index) { if ($index !== $count) { $errorPosIndex = ($errorPos + $tagElement[$i]->getLine()); - $error = ucfirst($tag).' tags must be grouped together'; + $error = "@$tag tags must be grouped together"; $this->currentFile->addError($error, $errorPosIndex); } @@ -309,7 +337,7 @@ $errorPos += $tagElement[0]->getLine(); } - $error = "The order of $tag tag is wrong in $docBlock comment"; + $error = "The order of @$tag tag is wrong in $docBlock comment"; $this->currentFile->addError($error, $errorPos); } @@ -353,7 +381,7 @@ if ($indentInfo['space'] !== 0 && $indentInfo['space'] !== ($longestTag + 1)) { $expected = (($longestTag - strlen($indentInfo['tag'])) + 1); $space = ($indentInfo['space'] - strlen($indentInfo['tag'])); - $error = ucfirst($indentInfo['tag']).' tag comment indented incorrectly. '; + $error = "@$indentInfo[tag] tag comment indented incorrectly. "; $error .= "Expected $expected spaces but found $space."; $getTagMethod = 'get'.ucfirst($indentInfo['tag']); if ($tags[$indentInfo['tag']]['allow_multiple'] === true) { @@ -421,7 +449,7 @@ $this->currentFile->addError($error, $errorPos); } } else { - $error = 'Category tag must contain a name'; + $error = '@category tag must contain a name'; $this->currentFile->addError($error, $errorPos); } } @@ -455,7 +483,7 @@ $this->currentFile->addError($error, $errorPos); } } else { - $error = 'Package tag must contain a name'; + $error = '@package tag must contain a name'; $this->currentFile->addError($error, $errorPos); } } @@ -488,12 +516,12 @@ // 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 <username@example.com>"'; + $error = 'Content of the @author tag must be in the form "Display Name <username@example.com>"'; $this->currentFile->addError($error, $errorPos); } } else { $docBlock = (get_class($this) === 'PEAR_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class'; - $error = "Content missing for author tag in $docBlock comment"; + $error = "Content missing for @author tag in $docBlock comment"; $this->currentFile->addError($error, $errorPos); } } @@ -530,11 +558,11 @@ } } } else { - $error = 'Copyright tag must contain a year and the name of the copyright holder'; + $error = '@copyright tag must contain a year and the name of the copyright holder'; $this->currentFile->addError($error, $errorPos); } } else { - $error = 'Copyright tag must contain a year and the name of the copyright holder'; + $error = '@copyright tag must contain a year and the name of the copyright holder'; $this->currentFile->addError($error, $errorPos); }//end if }//end if @@ -556,7 +584,7 @@ $value = $license->getValue(); $comment = $license->getComment(); if ($value === '' || $comment === '') { - $error = 'License tag must contain a URL and a license name'; + $error = '@license tag must contain a URL and a license name'; $this->currentFile->addError($error, $errorPos); } } @@ -578,7 +606,7 @@ $content = $version->getContent(); $matches = array(); if (empty($content) === true) { - $error = 'Content missing for version tag in file comment'; + $error = 'Content missing for @version tag in file comment'; $this->currentFile->addError($error, $errorPos); } else if ((strstr($content, 'CVS:')) === false) { http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php?r1=1.11&r2=1.12&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php:1.11 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php:1.12 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php:1.11 Fri Jan 12 03:49:53 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php Wed Jan 24 22:21:15 2007 @@ -10,7 +10,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: FunctionCommentSniff.php,v 1.11 2007/01/12 03:49:53 squiz Exp $ + * @version CVS: $Id: FunctionCommentSniff.php,v 1.12 2007/01/24 22:21:15 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -80,7 +80,7 @@ * * @var PHP_CodeSniffer_File */ - private $_phpcsFile = null; + protected $currentFile = null; /** @@ -106,9 +106,9 @@ */ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { - $this->_phpcsFile = $phpcsFile; + $this->currentFile = $phpcsFile; - $tokens = $this->_phpcsFile->getTokens(); + $tokens = $phpcsFile->getTokens(); $find = array( T_COMMENT, @@ -182,32 +182,37 @@ $newlineCount = (substr_count($short, "\n") + 1); // Exactly one blank line between short and long description. - $between = $comment->getWhiteSpaceBetween(); - $long = $comment->getLongComment(); - $newlineBetween = substr_count($between, "\n"); - if ($newlineBetween !== 2 && $long !== '') { - $error = 'There must be exactly one blank line between descriptions in function comment'; - $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); - } - - $newlineCount += $newlineBetween; - - // Exactly one blank line before params. - $newlineSpan = $comment->getNewlineAfter(); - $parameters = $this->commentParser->getParams(); - if ($newlineSpan !== 2 && (empty($parameters) === false || $this->commentParser->getReturn() !== null)) { - $error = 'There must be exactly one blank line before the parameters in function comment'; - if ($long !== '') { - $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); + $long = $comment->getLongComment(); + if (empty($long) === false) { + $between = $comment->getWhiteSpaceBetween(); + $newlineBetween = substr_count($between, "\n"); + if ($newlineBetween !== 2) { + $error = 'There must be exactly one blank line between descriptions in function comment'; + $phpcsFile->addError($error, ($commentStart + $newlineCount + 1)); } - $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $newlineCount += $newlineBetween; + } + + // Exactly one blank line before tags. + $params = $this->commentParser->getTagOrders(); + if (count($params) > 1) { + $newlineSpan = $comment->getNewlineAfter(); + if ($newlineSpan !== 2) { + $error = 'There must be exactly one blank line before the tags in function comment'; + if ($long !== '') { + $newlineCount += (substr_count($long, "\n") - $newlineSpan + 1); + } + + $phpcsFile->addError($error, ($commentStart + $newlineCount)); + $short = rtrim($short, "\n "); + } } // Check for unknown/deprecated tags. $unknownTags = $this->commentParser->getUnknown(); foreach ($unknownTags as $errorTag) { - $error = ucfirst($errorTag['tag']).' tag is not allowed in function comment'; + $error = "@$errorTag[tag] tag is not allowed in function comment"; $phpcsFile->addWarning($error, ($commentStart + $errorTag['line'])); } @@ -233,8 +238,8 @@ $errorPos = ($commentStart + $throw->getLine()); if ($comment === '') { - $error = 'Throw tag must contain a comment'; - $this->_phpcsFile->addError($error, $errorPos); + $error = '@throws tag must contain a comment'; + $this->currentFile->addError($error, $errorPos); } } @@ -254,7 +259,7 @@ // Skip constructor and destructor. $className = ''; if ($this->_classToken !== null) { - $className = $this->_phpcsFile->getDeclarationName($this->_classToken); + $className = $this->currentFile->getDeclarationName($this->_classToken); $className = strtolower(ltrim($className, '_')); } @@ -264,12 +269,12 @@ if ($isSpecialMethod === false && $methodName !== $className) { // Report missing return tag. if ($this->commentParser->getReturn() === null) { - $error = 'Missing return tag in function comment'; - $this->_phpcsFile->addError($error, $commentEnd); + $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'; + $error = '@return tag is empty in function comment'; $errorPos = ($commentStart + $this->commentParser->getReturn()->getLine()); - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } } @@ -286,7 +291,7 @@ */ private function _processParams($commentStart) { - $realParams = $this->_phpcsFile->getMethodParameters($this->_functionToken); + $realParams = $this->currentFile->getMethodParameters($this->_functionToken); $params = $this->commentParser->getParams(); $foundParams = array(); @@ -296,14 +301,14 @@ if (substr_count($params[(count($params) - 1)]->getWhitespaceAfter(), "\n") !== 2) { $error = 'Last parameter comment requires a blank newline after it'; $errorPos = ($params[(count($params) - 1)]->getLine() + $commentStart); - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } // Parameters must appear immediately after the comment. if ($params[0]->getOrder() !== 2) { $error = 'Parameters must appear immediately after the comment'; $errorPos = ($params[0]->getLine() + $commentStart); - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } $previousParam = null; @@ -320,7 +325,7 @@ // Make sure that there is only one space before the var type. if ($param->getWhitespaceBeforeType() !== ' ') { $error = 'Expected 1 space before variable type'; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } $spaceCount = substr_count($param->getWhitespaceBeforeVarName(), ' '); @@ -347,7 +352,7 @@ // Check to see if the parameters align properly. if ($param->alignsWith($previousParam) === false) { $error = 'Parameters '.$previousName.' ('.($pos - 1).') and '.$paramName.' ('.$pos.') do not align'; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } } @@ -366,27 +371,27 @@ $error .= '" does not match actual variable name "'.$realName; $error .= '" at position '.$pos; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } } else { // We must have an extra parameter comment. $error = 'Superfluous doc comment at position '.$pos; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } if ($param->getVarName() === '') { $error = 'Missing parameter name at position '.$pos; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } if ($param->getType() === '') { $error = 'Missing type at position '.$pos; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } if ($paramComment === '') { $error = 'Missing comment for param "'.$paramName.'" at position '.$pos; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } $previousParam = $param; @@ -395,12 +400,12 @@ if ($spaceBeforeVar !== 1 && $spaceBeforeVar !== 10000 && $spaceBeforeComment !== 10000) { $error = 'Expected 1 space after the longest type'; - $this->_phpcsFile->addError($error, $longestType); + $this->currentFile->addError($error, $longestType); } if ($spaceBeforeComment !== 1 && $spaceBeforeComment !== 10000) { $error = 'Expected 1 space after the longest variable name'; - $this->_phpcsFile->addError($error, $longestVar); + $this->currentFile->addError($error, $longestVar); } }//end if @@ -420,7 +425,7 @@ } $error = 'Doc comment for "'.$neededParam.'" missing'; - $this->_phpcsFile->addError($error, $errorPos); + $this->currentFile->addError($error, $errorPos); } }//end _processParams() http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc?r1=1.5&r2=1.6&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc:1.5 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc:1.6 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc:1.5 Fri Jan 12 03:50:43 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc Wed Jan 24 22:21:15 2007 @@ -75,6 +75,7 @@ * @see Net_Sample::Net_Sample() * @see Net_Other * @deprecated asd + * @unknown Unknown tag * @since Class available since Release 1.2.0 */ class Checking_Tags http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php?r1=1.8&r2=1.9&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php:1.8 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php:1.9 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php:1.8 Fri Jan 12 03:50:43 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php Wed Jan 24 22:21:16 2007 @@ -10,7 +10,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: ClassCommentUnitTest.php,v 1.8 2007/01/12 03:50:43 squiz Exp $ + * @version CVS: $Id: ClassCommentUnitTest.php,v 1.9 2007/01/24 22:21:16 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -59,8 +59,8 @@ 75 => 1, 76 => 1, 77 => 1, - 82 => 1, - 90 => 1, + 83 => 1, + 91 => 1, ); }//end getErrorList() @@ -79,6 +79,7 @@ return array( 69 => 1, 71 => 1, + 78 => 1, ); }//end getWarningList() http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc?r1=1.7&r2=1.8&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc:1.7 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc:1.8 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc:1.7 Fri Jan 12 03:50:43 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc Wed Jan 24 22:21:16 2007 @@ -193,6 +193,7 @@ * @param int $one comment * * @return void + * @error Unknown tag */ public function missingTwoParamComment($one, $two, $three) { http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php?r1=1.11&r2=1.12&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php:1.11 pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php:1.12 --- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php:1.11 Fri Jan 12 03:50:43 2007 +++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php Wed Jan 24 22:21:16 2007 @@ -10,7 +10,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: FunctionCommentUnitTest.php,v 1.11 2007/01/12 03:50:43 squiz Exp $ + * @version CVS: $Id: FunctionCommentUnitTest.php,v 1.12 2007/01/24 22:21:16 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -65,7 +65,7 @@ 172 => 1, 183 => 1, 193 => 2, - 203 => 1, + 204 => 1, ); }//end getErrorList() @@ -81,7 +81,9 @@ */ public function getWarningList() { - return array(); + return array( + 196 => 1, + ); }//end getWarningList()
« previous php.pear.cvs (#44374) next »