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

Class: ConstructorNameSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php

Class Overview

AbstractScopeSniff
   |
   --ConstructorNameSniff

Bans PHP 4 style constructors.


Author(s):

Copyright:

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

Methods


Inherited Variables

Inherited Methods

Class: AbstractScopeSniff

AbstractScopeSniff::__construct()
Constructs a new AbstractScopeTest.
AbstractScopeSniff::process()
Processes the tokens that this test is listening for.
AbstractScopeSniff::processTokenOutsideScope()
Processes a token that is found outside the scope that this test is listening to.
AbstractScopeSniff::processTokenWithinScope()
Processes a token that is found within the scope that this test is listening to.
AbstractScopeSniff::register()
The method that is called to register the tokens this test wishes to listen to.

Class Details

[line 19]
Bans PHP 4 style constructors.

Favor PHP 5 constructor syntax, which uses "function __construct()". Avoid PHP 4 constructor syntax, which uses "function ClassName()".



[ Top ]


Method Detail

__construct (Constructor)   [line 40]

ConstructorNameSniff __construct( )

Constructs the test with the tokens it wishes to listen for.
  • Access: public

Overrides AbstractScopeSniff::__construct() (Constructs a new AbstractScopeTest.)
[ Top ]

loadFunctionNamesInScope   [line 129]

void loadFunctionNamesInScope( File $phpcsFile, int $currScope)

Extracts all the function names found in the given scope.
  • Access: protected

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The current file being scanned.
int   $currScope   —  A pointer to the start of the scope.

[ Top ]

processTokenOutsideScope   [line 115]

void processTokenOutsideScope( File $phpcsFile, int $stackPtr)

Processes a token that is found within the scope that this test is listening to.
  • Access: protected

Overrides AbstractScopeSniff::processTokenOutsideScope() (Processes a token that is found outside the scope that this test is listening to.)

Parameters:

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

[ Top ]

processTokenWithinScope   [line 57]

void processTokenWithinScope( File $phpcsFile, int $stackPtr, int $currScope)

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

Overrides AbstractScopeSniff::processTokenWithinScope() (Processes a token that is found within the scope that this test is listening to.)

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The current file being scanned.
int   $stackPtr   —  The position of the current token in the stack passed in $tokens.
int   $currScope   —  A pointer to the start of the scope.

[ Top ]


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