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

Class: StaticThisUsageSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Standards/Squiz/Sniffs/Scope/StaticThisUsageSniff.php

Class Overview

AbstractScopeSniff
   |
   --StaticThisUsageSniff

Checks for usage of $this in static methods, which will cause runtime errors.


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 15]
Checks for usage of $this in static methods, which will cause runtime errors.


[ Top ]


Method Detail

__construct (Constructor)   [line 22]

StaticThisUsageSniff __construct( )

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

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

processTokenOutsideScope   [line 85]

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

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

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

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