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

Class: DisallowAlternativePHPTagsSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php

Class Overview


Verifies that no alternative PHP tags are used.


Author(s):

Copyright:

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

Methods


Inherited Variables

Inherited Methods


Class Details

[line 18]
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.



[ Top ]


Method Detail

addChangeset   [line 230]

void addChangeset( File $phpcsFile, array $tokens, int $openTagPointer, int $closeTagPointer, [bool $echo = false])

Add a changeset to replace the alternative PHP tags.
  • Access: protected

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The file being scanned.
array   $tokens   —  The token stack.
int   $openTagPointer   —  Stack pointer to the PHP open tag.
int   $closeTagPointer   —  Stack pointer to the PHP close tag.
bool   $echo   —  Whether to add 'echo' or not.

[ Top ]

findClosingTag   [line 206]

int|false findClosingTag( File $phpcsFile, array $tokens, int $stackPtr, string $content)

Try and find a matching PHP closing tag.
  • Return: Pointer to the position in the stack for the closing tag or false if not found.
  • Access: protected

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The file being scanned.
array   $tokens   —  The token stack.
int   $stackPtr   —  The position of the current token in the stack passed in $tokens.
string   $content   —  The expected content of the closing tag to match the opener.

[ Top ]

getSnippet   [line 174]

string getSnippet( string $content, [string $start = ''], [int $length = 40])

Get a snippet from a HTML token.
  • Access: protected

Parameters:

string   $content   —  The content of the HTML token.
string   $start   —  Partial string to use as a starting point for the snippet.
int   $length   —  The target length of the snippet to get. Defaults to 40.

[ Top ]

process   [line 72]

void process( File $phpcsFile, int $stackPtr)

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

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The file being scanned.
int   $stackPtr   —  The position of the current token in the stack passed in $tokens.

[ Top ]

register   [line 41]

array register( )

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

[ Top ]


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