PHP_CodeSniffer
[ class tree: PHP_CodeSniffer ] [ index: PHP_CodeSniffer ] [ all elements ]

Class: PEAR_Sniffs_Commenting_FileCommentSniff

Source Location: /PHP_CodeSniffer-1.5.2/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php

Class Overview


Parses and verifies the doc comments for files.


Author(s):

Version:

  • Release: 1.5.2

Copyright:

  • 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)

Variables

Methods


Child classes:

PEAR_Sniffs_Commenting_ClassCommentSniff
Parses and verifies the doc comments for classes.

Inherited Variables

Inherited Methods


Class Details

[line 45]
Parses and verifies the doc comments for files.

Verifies that :

  • A doc comment exists.
  • There is a blank newline after the short description.
  • There is a blank newline between the long and short description.
  • There is a blank newline between the long description and tags.
  • A PHP version is specified.
  • Check the order of the tags.
  • Check the indentation of each tag.
  • Check required and optional tags and the format of their content.



[ Top ]


Class Variables

$commentParser =  null

[line 53]

The header comment parser for the current file.
  • Access: protected

Type:   PHP_CodeSniffer_Comment_Parser_ClassCommentParser


[ Top ]

$currentFile =  null

[line 60]

The current PHP_CodeSniffer_File object we are processing.
  • Access: protected



[ Top ]

$tags = array(
                       'category'   => array(
                                        'required'       => true,
                                        'allow_multiple' => false,
                                        'order_text'     => 'precedes @package',
                                       ),'package'=>array('required'=>true,'allow_multiple'=>false,'order_text'=>'follows @category',),'subpackage'=>array('required'=>false,'allow_multiple'=>false,'order_text'=>'follows @package',),'author'=>array('required'=>true,'allow_multiple'=>true,'order_text'=>'follows @subpackage (if used) or @package',),'copyright'=>array('required'=>false,'allow_multiple'=>true,'order_text'=>'follows @author',),'license'=>array('required'=>true,'allow_multiple'=>false,'order_text'=>'follows @copyright (if used) or @author',),'version'=>array('required'=>false,'allow_multiple'=>false,'order_text'=>'follows @license',),'link'=>array('required'=>true,'allow_multiple'=>true,'order_text'=>'follows @version',),'see'=>array('required'=>false,'allow_multiple'=>true,'order_text'=>'follows @link',),'since'=>array('required'=>false,'allow_multiple'=>false,'order_text'=>'follows @see (if used) or @link',),'deprecated'=>array('required'=>false,'allow_multiple'=>false,'order_text'=>'follows @since (if used) or @see (if used) or @link',),)

[line 67]

Tags in correct order and related info.
  • Access: protected

Type:   array


[ Top ]



Method Detail

getIndentation   [line 521]

void getIndentation( string $tagName, PHP_CodeSniffer_CommentParser_DocElement $tagElement)

Get the indentation information of each tag.
  • Access: protected

Parameters:

string   $tagName   —  The name of the doc comment element.
PHP_CodeSniffer_CommentParser_DocElement   $tagElement   —  The doc comment element.

[ Top ]

process   [line 147]

void process( PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

Processes this test, when one of its tokens is encountered.
  • Access: public

Overridden in child classes as:

PEAR_Sniffs_Commenting_ClassCommentSniff::process()
Processes this test, when one of its tokens is encountered.

Parameters:

PHP_CodeSniffer_File   $phpcsFile   —  The file being scanned.
int   $stackPtr   —  The position of the current token in the stack passed in $tokens.

[ Top ]

processAuthors   [line 673]

void processAuthors( int $commentStart)

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

  • Access: protected

Parameters:

int   $commentStart   —  The position in the stack where the comment started.

[ Top ]

processCategory   [line 545]

void processCategory( int $errorPos)

Process the category tag.
  • Access: protected

Parameters:

int   $errorPos   —  The line number where the error occurs.

[ Top ]

processCopyrights   [line 710]

void processCopyrights( int $commentStart)

Process the copyright tags.
  • Access: protected

Parameters:

int   $commentStart   —  The position in the stack where the comment started.

[ Top ]

processLicense   [line 751]

void processLicense( int $errorPos)

Process the license tag.
  • Access: protected

Parameters:

int   $errorPos   —  The line number where the error occurs.

[ Top ]

processPackage   [line 584]

void processPackage( int $errorPos)

Process the package tag.
  • Access: protected

Parameters:

int   $errorPos   —  The line number where the error occurs.

[ Top ]

processPHPVersion   [line 333]

void processPHPVersion( int $commentStart, int $commentEnd, string $commentText)

Check that the PHP version is specified.
  • Access: protected

Parameters:

int   $commentStart   —  Position in the stack where the comment started.
int   $commentEnd   —  Position in the stack where the comment ended.
string   $commentText   —  The text of the function comment.

[ Top ]

processSubpackage   [line 629]

void processSubpackage( int $errorPos)

Process the subpackage tag.
  • Access: protected

Parameters:

int   $errorPos   —  The line number where the error occurs.

[ Top ]

processTags   [line 351]

void processTags( int $commentStart, int $commentEnd)

Processes each required or optional tag.
  • Access: protected

Parameters:

int   $commentStart   —  Position in the stack where the comment started.
int   $commentEnd   —  Position in the stack where the comment ended.

[ Top ]

processVersion   [line 773]

void processVersion( int $errorPos)

Process the version tag.
  • Access: protected

Overridden in child classes as:

PEAR_Sniffs_Commenting_ClassCommentSniff::processVersion()
Process the version tag.

Parameters:

int   $errorPos   —  The line number where the error occurs.

[ Top ]

register   [line 131]

array register( )

Returns an array of tokens this test wants to listen for.
  • Access: public

Overridden in child classes as:

PEAR_Sniffs_Commenting_ClassCommentSniff::register()
Returns an array of tokens this test wants to listen for.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:56:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.