Documentation

Scopes

Utility functions for use when examining token scopes.

Table of Contents

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

Methods

validDirectScope()

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

public static validDirectScope( $phpcsFile : File , $stackPtr : int , $validScopes : int|string|array ) : int|bool
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

Array of token constants representing the scopes considered valid.

Tags
since
Return values
int|bool

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

isOOConstant()

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

public static isOOConstant( $phpcsFile : File , $stackPtr : int ) : 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
Return values
bool

isOOProperty()

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

public static isOOProperty( $phpcsFile : File , $stackPtr : int ) : 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
Return values
bool

isOOMethod()

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

public static isOOMethod( $phpcsFile : File , $stackPtr : int ) : 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
Return values
bool

Search results