## Scopes

Scopes.php : 24

Utility functions for use when examining token scopes.

##### Tags

since
  1.0.0

### Table of Contents

isOOConstant() : bool
  Check whether a T_CONST token is a class/interface constant declaration.
isOOMethod() : bool
  Check whether a T_FUNCTION token is a class/interface/trait 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()

Scopes.php : 69

Check whether a T_CONST token is a class/interface 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()

Scopes.php : 129

Check whether a T_FUNCTION token is a class/interface/trait 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()

Scopes.php : 95

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()

Scopes.php : 42

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 $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

  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.

## Search results