PEAR_Sniffs_Commenting_FileCommentSniff
in package
implements
PHP_CodeSniffer_Sniff
Parses and verifies the doc comments for files.
Tags
Interfaces, Classes and Traits
- PHP_CodeSniffer_Sniff
- Represents a PHP_CodeSniffer sniff for sniffing coding standards.
Table of Contents
- $tags : array<string|int, mixed>
- Tags in correct order and related info.
- process() : int
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
- processAuthor() : void
- Process the author tag(s) that this header comment has.
- processCategory() : void
- Process the category tag.
- processCopyright() : void
- Process the copyright tags.
- processLicense() : void
- Process the license tag.
- processPackage() : void
- Process the package tag.
- processSubpackage() : void
- Process the subpackage tag.
- processTags() : void
- Processes each required or optional tag.
- processVersion() : void
- Process the version tag.
Properties
$tags
Tags in correct order and related info.
protected
array<string|int, mixed>
$tags
= array('@category' => array('required' => rue, 'allow_multiple' => alse), '@package' => array('required' => rue, 'allow_multiple' => alse), '@subpackage' => array('required' => alse, 'allow_multiple' => alse), '@author' => array('required' => rue, 'allow_multiple' => rue), '@copyright' => array('required' => alse, 'allow_multiple' => rue), '@license' => array('required' => rue, 'allow_multiple' => alse), '@version' => array('required' => alse, 'allow_multiple' => alse), '@link' => array('required' => rue, 'allow_multiple' => rue), '@see' => array('required' => alse, 'allow_multiple' => rue), '@since' => array('required' => alse, 'allow_multiple' => alse), '@deprecated' => array('required' => alse, 'allow_multiple' => alse))
Methods
process()
Processes this test, when one of its tokens is encountered.
public
process(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : int
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Return values
int —register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>
Return values
array<string|int, mixed> —processAuthor()
Process the author tag(s) that this header comment has.
protected
processAuthor(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processCategory()
Process the category tag.
protected
processCategory(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processCopyright()
Process the copyright tags.
protected
processCopyright(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processLicense()
Process the license tag.
protected
processLicense(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processPackage()
Process the package tag.
protected
processPackage(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processSubpackage()
Process the subpackage tag.
protected
processSubpackage(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processTags()
Processes each required or optional tag.
protected
processTags(PHP_CodeSniffer_File $phpcsFile, int $stackPtr, int $commentStart) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
- $commentStart : int
-
Position in the stack where the comment started.
Return values
void —processVersion()
Process the version tag.
protected
processVersion(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.