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

Class: ForbiddenFunctionsSniff

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

Class Overview


Discourages the use of alias functions.


Author(s):

Copyright:

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

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 18]
Discourages the use of alias functions.

Alias functions are kept in PHP for compatibility with older versions. Can be used to forbid the use of any function.



[ Top ]


Class Variables

$error =  true

[line 53]

If true, an error will be thrown; otherwise a warning.
  • Access: public

Type:   boolean


[ Top ]

$forbiddenFunctionNames = array()

[line 39]

A cache of forbidden function names, for faster lookups.
  • Access: protected

Type:   string[]


[ Top ]

$forbiddenFunctions = array(
                                  'sizeof' => 'count',
                                  'delete' => 'unset',
                                 )

[line 29]

A list of forbidden functions with their alternatives.

The value is NULL if no alternative exists. IE, the function should just not be used.

  • Var: string|null>
  • Access: public

Type:   array


[ Top ]

$patternMatch =  false

[line 46]

If true, forbidden functions will be considered regular expressions.
  • Access: protected

Type:   boolean


[ Top ]



Method Detail

addError   [line 197]

void addError( \PHP_CodeSniffer\Files\File $phpcsFile, int $stackPtr, string $function, [string $pattern = null])

Generates the error or warning for this sniff.
  • Access: protected

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The file being scanned.
int   $stackPtr   —  The position of the forbidden function in the token array.
string   $function   —  The name of the forbidden function.
string   $pattern   —  The pattern used for the match.

[ Top ]

process   [line 109]

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

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:29 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.