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

Class: PHP_CodeSniffer_Standards_AbstractPatternSniff

Source Location: /PHP_CodeSniffer-0.7.0/CodeSniffer/Standards/AbstractPatternSniff.php

Class Overview


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


Author(s):

Version:

  • Release: 0.7.0

Copyright:

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

Methods


Child classes:

Squiz_Sniffs_ControlStructures_ControlSignatureSniff
Verifies that control statements conform to their coding standards.
Squiz_Sniffs_Functions_FunctionDeclarationSniff
Squiz_Sniffs_Functions_FunctionDeclarationSniff.
PEAR_Sniffs_ControlStructures_ControlSignatureSniff
Verifies that control statements conform to their coding standards.

Inherited Variables

Inherited Methods


Class Details

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

This test essentially checks that code is correctly formatted with whitespace.



[ Top ]


Method Detail

__construct (Constructor)   [line 75]

PHP_CodeSniffer_Standards_AbstractPatternSniff __construct( [boolean $ignoreComments = false])

Constructs a PHP_CodeSniffer_Standards_AbstractPatternSniff.
  • Access: public

Overridden in child classes as:

PEAR_Sniffs_ControlStructures_ControlSignatureSniff::__construct()
Constructs a PEAR_Sniffs_ControlStructures_ControlSignatureSniff.

Parameters:

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

[ Top ]

getPatterns   [line 573]

array(string) getPatterns( )

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

Overridden in child classes as:

Squiz_Sniffs_ControlStructures_ControlSignatureSniff::getPatterns()
Returns the patterns that this test wishes to verify.
Squiz_Sniffs_Functions_FunctionDeclarationSniff::getPatterns()
Returns an array of patterns to check are correct.
PEAR_Sniffs_ControlStructures_ControlSignatureSniff::getPatterns()
Returns the patterns that this test wishes to verify.

[ Top ]

prepareError   [line 554]

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 197]

void process( PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

Processes the test.

Parameters:

PHP_CodeSniffer_File   $phpcsFile   —  The PHP_CodeSniffer file where the token occured.
int   $stackPtr   —  The postion in the tokens stack where the listening token type was found.

[ Top ]

processPattern   [line 258]

array(errors) processPattern( array $patternInfo, PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

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

Parameters:

array   $patternInfo   —  Information about the pattern used for checking, which includes are parsed otken representation of the pattern.
PHP_CodeSniffer_File   $phpcsFile   —  The PHP_CodeSniffer file where the token occured.
int   $stackPtr   —  The postion in the tokens stack where the listening token type was found.

[ Top ]

processSupplementary   [line 604]

void processSupplementary( PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

Processes any tokens registered with registerSupplementary().

Parameters:

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

[ Top ]

register   [line 92]

array(int) register( )

Registers the tokens to listen to.

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


[ Top ]

registerSupplementary   [line 586]

array(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 arbitary validation that cannot be performed using a pattern, with other pattern tests.


[ Top ]


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