PHPCSUtils 1.0.11

Scopes
in package

FinalYes

Utility functions for use when examining token scopes.

Tags
since
1.0.0

Table of Contents

Methods

isOOConstant()  : bool
Check whether a T_CONST token is a class/interface/trait/enum constant declaration.
isOOMethod()  : bool
Check whether a T_FUNCTION token is a class/interface/trait/enum method declaration.
isOOProperty()  : bool
Check whether a T_VARIABLE token is a class/trait property declaration.
validDirectScope()  : int|false
Check whether the direct wrapping scope of a token is within a limited set of acceptable tokens.

Methods

isOOConstant()

Check whether a T_CONST token is a class/interface/trait/enum constant declaration.

public static isOOConstant(File $phpcsFile, int $stackPtr) : bool
Parameters
$phpcsFile : File

The file where this token was found.

$stackPtr : int

The position in the stack of the T_CONST token to verify.

Tags
since
1.0.0
Return values
bool

isOOMethod()

Check whether a T_FUNCTION token is a class/interface/trait/enum method declaration.

public static isOOMethod(File $phpcsFile, int $stackPtr) : bool
Parameters
$phpcsFile : File

The file where this token was found.

$stackPtr : int

The position in the stack of the T_FUNCTION token to verify.

Tags
since
1.0.0
Return values
bool

isOOProperty()

Check whether a T_VARIABLE token is a class/trait property declaration.

public static isOOProperty(File $phpcsFile, int $stackPtr) : bool
Parameters
$phpcsFile : File

The file where this token was found.

$stackPtr : int

The position in the stack of the T_VARIABLE token to verify.

Tags
since
1.0.0
Return values
bool

validDirectScope()

Check whether the direct wrapping scope of a token is within a limited set of acceptable tokens.

public static validDirectScope(File $phpcsFile, int $stackPtr, int|string|array<string|int, int|string> $validScopes) : int|false
Parameters
$phpcsFile : File

The file where this token was found.

$stackPtr : int

The position in the stack of the token to verify.

$validScopes : int|string|array<string|int, int|string>

Array of token constants representing the scopes considered valid.

Tags
since
1.0.0
Return values
int|false

Integer stack pointer to the valid direct scope; or FALSE if no valid direct scope was found.


        
On this page

Search results