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

Class: AbstractPatternSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Sniffs/AbstractPatternSniff.php

Class Overview


Processes pattern strings and checks that the code conforms to the pattern.


Author(s):

Copyright:

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

Variables

Methods


Child classes:

Checks the function declaration is correct.
Verifies that control statements conform to their coding standards.

Inherited Variables

Inherited Methods


Class Details

[line 18]
Processes pattern strings and checks that the code conforms to the pattern.


[ Top ]


Class Variables

$currFile =  ''

[line 33]

The current file being checked.
  • Access: protected

Type:   string


[ Top ]

$ignoreComments =  false

[line 26]

If true, comments will be ignored if they are found in the code.
  • Access: public

Type:   boolean


[ Top ]



Method Detail

__construct (Constructor)   [line 64]

AbstractPatternSniff __construct( [boolean $ignoreComments = null])

Constructs a AbstractPatternSniff.
  • Access: public

Parameters:

boolean   $ignoreComments   —  If true, comments will be ignored.

[ Top ]

getPatterns   [line 725]

string[] getPatterns( )

Returns the patterns that should be checked.
  • Abstract:
  • Access: protected

Overridden in child classes as:

Returns an array of patterns to check are correct.
Returns the patterns that this test wishes to verify.

[ Top ]

prepareError   [line 704]

string prepareError( string $found, string $patternCode)

Prepares an error for the specified patternCode.
  • Return: The error message.
  • Access: protected

Parameters:

string   $found   —  The actual found string in the code.
string   $patternCode   —  The expected pattern code.

[ Top ]

process   [line 188]

void process( File $phpcsFile, int $stackPtr)

Processes the test.
  • See: register()
  • Access: public

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where the token occurred.
int   $stackPtr   —  The position in the tokens stack where the listening token type was found.

[ Top ]

processPattern   [line 256]

array processPattern( array $patternInfo, File $phpcsFile, int $stackPtr)

Processes the pattern and verifies the code at $stackPtr.
  • Access: protected

Parameters:

array   $patternInfo   —  Information about the pattern used for checking, which includes are parsed token representation of the pattern.
\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where the token occurred.
int   $stackPtr   —  The position in the tokens stack where the listening token type was found.

[ Top ]

processSupplementary   [line 756]

void processSupplementary( File $phpcsFile, int $stackPtr)

Processes any tokens registered with registerSupplementary().
  • See: registerSupplementary()
  • Access: protected

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where to process the skip.
int   $stackPtr   —  The position in the tokens stack to process.

[ Top ]

register   [line 85]

int[] register( )

Registers the tokens to listen to.

Classes extending AbstractPatternTest should implement the getPatterns() method to register the patterns they wish to test.

  • See: process()
  • Access: public

[ Top ]

registerSupplementary   [line 738]

int[] registerSupplementary( )

Registers any supplementary tokens that this test might wish to process.

A sniff may wish to register supplementary tests when it wishes to group an arbitrary validation that cannot be performed using a pattern, with other pattern tests.

  • See: processSupplementary()
  • Access: protected

[ Top ]


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