TypeConstantDeclaration

A declared class type constant.

class TypeConstantDeclaration implements TokenDeclaration<ScannedTypeConstant>
Copyright
2016 Appertly
License
Apache-2.0

Constructors / Destructors

Public
ReturnsSignature and Description
void
__construct(ScannedTypeConstant $constant, Block $block, ?ScannedClass $class = null)

Creates a new ConstantDeclaration.

Instance Methods

Public
ReturnsSignature and Description
?ScannedClass

Gets the containing class.

Block

Gets the doc comment block.

string

Gets the source filename.

string

Gets the name of the declaration.

string

Gets the best summary for the property.

ScannedTypeConstant

Gets the scanned token.

?ScannedTypehint

Gets the best type hints for the property.

Method Details

__construct

public function __construct(ScannedTypeConstant $constant, Block $block, ?ScannedClass $class = null)

Creates a new ConstantDeclaration.

Parameters
NameTypeDescription
$constantScannedTypeConstant

The property

$blockBlock

The doc comment

$class?ScannedClass

Optional. The interface, trait, or class

getClass

public function getClass()

Gets the containing class.

Returns
TypeDescription
?ScannedClass

The containing class

getDocBlock

public function getDocBlock()

Gets the doc comment block.

Returns
TypeDescription
Block

The doc block, which could be empty

getFilename

public function getFilename()

Gets the source filename.

Returns
TypeDescription
string

The filename

getName

public function getName()

Gets the name of the declaration.

Returns
TypeDescription
string

The declaration name

getSummary

public function getSummary()

Gets the best summary for the property.

Either the PHPDoc summary, or the description of its var tag.

Returns
TypeDescription
string

The summary

getToken

public function getToken()

Gets the scanned token.

Returns
TypeDescription
ScannedTypeConstant

The scanned token

getType

public function getType()

Gets the best type hints for the property.

Either the inline typehint, or if omitted or mixed, we use the tags.

Returns
TypeDescription
?ScannedTypehint

The type hints