\Joomla_Sniffs_Commenting_FunctionCommentSniff
Parses and verifies the doc comments for functions.
Verifies that :
<ul>
<li>A comment exists</li>
<li>There is a blank newline after the short description.</li>
<li>There is a blank newline between the long and short description.</li>
<li>There is a blank newline between the long description and tags.</li>
<li>Parameter names represent those in the method.</li>
<li>Parameter comments are in the correct order</li>
<li>Parameter comments are complete</li>
<li>A space is present before the first and after the last parameter</li>
<li>A return type exists</li>
<li>There must be one blank line between body and headline comments.</li>
<li>Any throw tag must have an exception class.</li>
</ul>
- Author: Greg Sherwood <gsherwood@squiz.net>
- Copyright: 2006 Squiz Pty Ltd (ABN 77 084 670 600)
- License: http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
Synopsis
class Joomla_Sniffs_Commenting_FunctionCommentSniff
implements
PHP_CodeSniffer_Sniff
{
- // members
- private $_methodName;
- private $_functionToken;
- private $_classToken;
- protected PHP_CodeSniffer_Comment_Parser_FunctionCommentParser $commentParser;
- protected PHP_CodeSniffer_File $currentFile;
- // methods
- public array register()
- public void process()
- protected void processThrows()
- protected void processReturn()
- protected void processParams()
Hierarchy
Implements
Members
private
- $_classToken
—
int
The position in the stack where the class token was found. - $_functionToken
—
int
The position in the stack where the fucntion token was found. - $_methodName
—
string
The name of the method that we are currently processing.
protected
- $commentParser
—
PHP_CodeSniffer_Comment_Parser_FunctionCommentParser
The function comment parser for the current method. - $currentFile
—
PHP_CodeSniffer_File
The current PHP_CodeSniffer_File object we are processing.
Methods
protected
- processParams() — Process the function parameter comments.
- processReturn() — Process the return comment of this function comment.
- processThrows() — Process any throw tags that this function comment has.
public
- process() — Processes this test, when one of its tokens is encountered.
- register() — Returns an array of tokens this test wants to listen for.