Class: FunctionDeclarationSniff
Source Location: /PHP_CodeSniffer-3.0.0/src/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
Ensure single and multi-line function declarations are defined correctly.
Author(s):
Copyright:
- 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
Inherited Variables
Inherited Methods
Class Details
[line
18]
Ensure single and multi-line function declarations are defined correctly.
Class Variables
$indent = 4
[line 36]
The number of spaces code should be indented.
$supportedTokenizers = array(
'PHP',
'JS',
)
[line 26]
A list of tokenizers this sniff supports.
Method Detail
isMultiLineDeclaration [line 194]
void isMultiLineDeclaration(
\PHP_CodeSniffer\Files\File
$phpcsFile, int
$stackPtr, int
$openBracket, array
$tokens)
Determine if this is a multi-line function declaration.
Parameters:
\PHP_CodeSniffer\Files\File
$phpcsFile
—
The file being scanned.
int
$stackPtr
—
The position of the current token in the stack passed in $tokens.
int
$openBracket
—
The position of the opening bracket in the stack passed in $tokens.
array
$tokens
—
The stack of tokens that make up the file.
process [line 63]
void process(
File
$phpcsFile, int
$stackPtr)
Processes this test, when one of its tokens is encountered.
Parameters:
\PHP_CodeSniffer\Files\File
$phpcsFile
—
The file being scanned.
int
$stackPtr
—
The position of the current token in the stack passed in $tokens.
processMultiLineDeclaration [line 258]
void processMultiLineDeclaration(
\PHP_CodeSniffer\Files\File
$phpcsFile, int
$stackPtr, array
$tokens)
Processes multi-line declarations.
Parameters:
\PHP_CodeSniffer\Files\File
$phpcsFile
—
The file being scanned.
int
$stackPtr
—
The position of the current token in the stack passed in $tokens.
array
$tokens
—
The stack of tokens that make up the file.
processSingleLineDeclaration [line 233]
void processSingleLineDeclaration(
\PHP_CodeSniffer\Files\File
$phpcsFile, int
$stackPtr, array
$tokens)
Processes single-line declarations.
Just uses the Generic BSD-Allman brace sniff.
Parameters:
\PHP_CodeSniffer\Files\File
$phpcsFile
—
The file being scanned.
int
$stackPtr
—
The position of the current token in the stack passed in $tokens.
array
$tokens
—
The stack of tokens that make up the file.
register [line 44]
Returns an array of tokens this test wants to listen for.
Documentation generated on 2019年3月11日 14:23:12 -0400 by
phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.