PHP Класс Phan\Language\Element\Parameter

Наследование: extends Variable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__clone ( ) : null After a clone is called on this object, clone our deep objects.
__construct ( Context $context, string $name, UnionType $type, integer $flags )
__toString ( ) : string
asNonVariadic ( ) : static Returns the Parameter in the form expected by a caller.
fromNode ( Context $context, CodeBase $code_base, ast\Node $node ) : Parameter
getDefaultValue ( ) : mixed
getDefaultValueType ( ) : UnionType
getUnionType ( ) : UnionType If this parameter is variadic (e.g. `DateTime .
getVariadicElementUnionType ( ) : UnionType If this Parameter is variadic, calling getUnionType will return an array type such as DateTime[]. This method will return the element type (such as DateTime) for variadic parameters.
hasDefaultValue ( ) : boolean
isOptional ( ) : boolean
isPassByReference ( ) : boolean
isRequired ( ) : boolean
isVariadic ( ) : boolean
listFromNode ( Context $context, CodeBase $code_base, ast\Node $node ) : array
setDefaultValue ( mixed $value ) : void
setDefaultValueType ( UnionType $type ) : void
setUnionType ( UnionType $type )

Описание методов

__clone() публичный Метод

After a clone is called on this object, clone our deep objects.
public __clone ( ) : null
Результат null

__construct() публичный Метод

public __construct ( Context $context, string $name, UnionType $type, integer $flags )
$context Phan\Language\Context The context in which the structural element lives
$name string
$type Phan\Language\UnionType
$flags integer

__toString() публичный Метод

public __toString ( ) : string
Результат string

asNonVariadic() публичный Метод

If this parameter is variadic (e.g. DateTime ...$args), then this would return a parameter with the type of the elements (e.g. DateTime) If this parameter is not variadic, returns $this.
public asNonVariadic ( ) : static
Результат static (usually $this)

fromNode() публичный статический Метод

См. также: Phan\Deprecated\Pass1::node_param Formerly `function node_param`
public static fromNode ( Context $context, CodeBase $code_base, ast\Node $node ) : Parameter
$context Phan\Language\Context
$code_base Phan\CodeBase
$node ast\Node
Результат Parameter A parameter built from a node

getDefaultValue() публичный Метод

public getDefaultValue ( ) : mixed
Результат mixed The value of the default for this parameter if one is defined, otherwise null.

getDefaultValueType() публичный Метод

public getDefaultValueType ( ) : UnionType
Результат Phan\Language\UnionType The type of the default value for this parameter if it exists

getUnionType() публичный Метод

..$args), then this returns the corresponding array type(s) of $args. (e.g. DateTime[]) NOTE: For variadic arguments, this is a temporary variable. Modifying this won't result in persistent changes. (TODO(Issue #376) : We will probably want to be able to modify the underlying variable, e.g. by creating class UnionTypeGenericArrayView extends UnionType. Otherwise, type inference of ...$args` based on the function source will be less effective without phpdoc types.)
public getUnionType ( ) : UnionType
Результат Phan\Language\UnionType

getVariadicElementUnionType() публичный Метод

If this Parameter is variadic, calling getUnionType will return an array type such as DateTime[]. This method will return the element type (such as DateTime) for variadic parameters.
public getVariadicElementUnionType ( ) : UnionType
Результат Phan\Language\UnionType

hasDefaultValue() публичный Метод

public hasDefaultValue ( ) : boolean
Результат boolean True if this parameter has a type for its default value

isOptional() публичный Метод

public isOptional ( ) : boolean
Результат boolean True if this is an optional parameter

isPassByReference() публичный Метод

public isPassByReference ( ) : boolean
Результат boolean True if this parameter is pass-by-reference i.e. prefixed with '&'.

isRequired() публичный Метод

public isRequired ( ) : boolean
Результат boolean True if this is a required parameter

isVariadic() публичный Метод

public isVariadic ( ) : boolean
Результат boolean True if this parameter is variadic, i.e. can take an unlimited list of parameters and express them as an array.

listFromNode() публичный статический Метод

См. также: Phan\Deprecated\Pass1::node_paramlist Formerly `function node_paramlist`
public static listFromNode ( Context $context, CodeBase $code_base, ast\Node $node ) : array
$context Phan\Language\Context
$code_base Phan\CodeBase
$node ast\Node
Результат array A list of parameters from an AST node.

setDefaultValue() публичный Метод

public setDefaultValue ( mixed $value ) : void
$value mixed The value of the default for this parameter
Результат void

setDefaultValueType() публичный Метод

public setDefaultValueType ( UnionType $type ) : void
$type Phan\Language\UnionType The type of the default value for this parameter
Результат void

setUnionType() публичный Метод

public setUnionType ( UnionType $type )
$type Phan\Language\UnionType