Constants
in package
FinalYes
Utility functions for use when examining constants declared using the "const" keyword.
Tags
Table of Contents
Methods
- getProperties() : array<string, string|int|bool>
- Retrieve the visibility and implementation properties of an OO constant.
Methods
getProperties()
Retrieve the visibility and implementation properties of an OO constant.
public
static getProperties(File $phpcsFile, int $stackPtr) : array<string, string|int|bool>
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position in the stack of the
T_CONST
token to acquire the properties for.
Tags
Return values
array<string, string|int|bool> —Array with information about the constant declaration. The format of the return value is:
array(
'scope' => string, // Public, private, or protected.
'scope_token' => integer|false, // The stack pointer to the scope keyword or
// FALSE if the scope was not explicitly specified.
'is_final' => boolean, // TRUE if the final keyword was found.
'final_token' => integer|false, // The stack pointer to the final keyword
// or FALSE if the const is not declared final.
'type' => string, // The type of the const (empty if no type specified).
'type_token' => integer|false, // The stack pointer to the start of the type
// or FALSE if there is no type.
'type_end_token' => integer|false, // The stack pointer to the end of the type
// or FALSE if there is no type.
'nullable_type' => boolean, // TRUE if the type is preceded by the
// nullability operator.
'name_token' => integer, // The stack pointer to the constant name.
// Note: for group declarations this points to the
// name of the first constant.
'equal_token' => integer, // The stack pointer to the equal sign.
// Note: for group declarations this points to the
// equal sign of the first constant.
);