PHP 클래스 Generic_Sniffs_PHP_DisallowAlternativePHPTagsSniff, PHP_CodeSniffer

Verifies that no alternative PHP tags are used. If alternative PHP open tags are found, this sniff can fix both the open and close tags.
저자: Greg Sherwood ([email protected])
저자: Marc McIntyre ([email protected])
상속: implements PHP_CodeSniffer_Sniff
파일 보기 프로젝트 열기: squizlabs/php_codesniffer

공개 메소드들

메소드 설명
process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void Processes this test, when one of its tokens is encountered.
register ( ) : array Returns an array of tokens this test wants to listen for.

보호된 메소드들

메소드 설명
addChangeset ( PHP_CodeSniffer_File $phpcsFile, array $tokens, integer $open_tag_pointer, integer $close_tag_pointer, boolean $echo = false ) : void Add a changeset to replace the alternative PHP tags.
findClosingTag ( PHP_CodeSniffer_File $phpcsFile, array $tokens, integer $stackPtr, string $content ) : integer | false Try and find a matching PHP closing tag.
getSnippet ( string $content, string $start_at = '', integer $length = 40 ) : string Get a snippet from a HTML token.

메소드 상세

addChangeset() 보호된 메소드

Add a changeset to replace the alternative PHP tags.
protected addChangeset ( PHP_CodeSniffer_File $phpcsFile, array $tokens, integer $open_tag_pointer, integer $close_tag_pointer, boolean $echo = false ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$tokens array The token stack.
$open_tag_pointer integer Stack pointer to the PHP open tag.
$close_tag_pointer integer Stack pointer to the PHP close tag.
$echo boolean Whether to add 'echo' or not.
리턴 void

findClosingTag() 보호된 메소드

Try and find a matching PHP closing tag.
protected findClosingTag ( PHP_CodeSniffer_File $phpcsFile, array $tokens, integer $stackPtr, string $content ) : integer | false
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$tokens array The token stack.
$stackPtr integer The position of the current token in the stack passed in $tokens.
$content string The expected content of the closing tag to match the opener.
리턴 integer | false Pointer to the position in the stack for the closing tag or false if not found.

getSnippet() 보호된 메소드

Get a snippet from a HTML token.
protected getSnippet ( string $content, string $start_at = '', integer $length = 40 ) : string
$content string The content of the HTML token.
$start_at string Partial string to use as a starting point for the snippet.
$length integer The target length of the snippet to get. Defaults to 40.
리턴 string

process() 공개 메소드

Processes this test, when one of its tokens is encountered.
public process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
리턴 void

register() 공개 메소드

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