FileCommentSniff
in package
implements
Sniff
File Comment Sniff
Check a doc comment exists. Check the order of the tags. Check the indentation of each tag. Check required and optional tags and the format of their content.
Tags
Interfaces, Classes and Traits
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.
- processLink() : void
- Process the link 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
= ['@package' => ['required' => false, 'allow_multiple' => false], '@subpackage' => ['required' => false, 'allow_multiple' => false], '@category' => ['required' => false, 'allow_multiple' => false], '@author' => ['required' => false, 'allow_multiple' => true], '@copyright' => ['required' => false, 'allow_multiple' => true], '@license' => ['required' => false, 'allow_multiple' => false], '@link' => ['required' => false, 'allow_multiple' => true], '@since' => ['required' => false, 'allow_multiple' => false], '@version' => ['required' => false, 'allow_multiple' => false], '@see' => ['required' => false, 'allow_multiple' => true], '@deprecated' => ['required' => false, 'allow_multiple' => false]]
Methods
process()
Processes this test, when one of its tokens is encountered.
public
process(File $phpcsFile, int $stackPtr) : int
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.
Return values
void —processLink()
Process the link tag.
protected
processLink(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, int $stackPtr, int $commentStart) : void
Parameters
- $phpcsFile : 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(File $phpcsFile, array<string|int, mixed> $tags) : void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $tags : array<string|int, mixed>
-
The tokens for these tags.