Constants

KIND_BIN

KIND_BIN = 2

KIND_OCT

KIND_OCT = 8

KIND_DEC

KIND_DEC = 10

KIND_HEX

KIND_HEX = 16

Properties

$value

$value : integer

Type

integer — Number value

$attributes

$attributes : 

Type

Methods

__construct()

__construct(integer  $value, array  $attributes = array()) 

Constructs an integer number scalar node.

Parameters

integer $value

Value of the number

array $attributes

Additional attributes

getType()

getType() : string

Gets the type of the node.

Returns

string —

Type of the node

getLine()

getLine() : integer

Gets line the node started in.

Returns

integer —

Line

setLine()

setLine(integer  $line) 

Sets line the node started in.

Parameters

integer $line

Line

getDocComment()

getDocComment() : null|\PhpParser\Comment\Doc

Gets the doc comment of the node.

The doc comment has to be the last comment associated with the node.

Returns

null|\PhpParser\Comment\Doc

Doc comment object or null

setDocComment()

setDocComment(\PhpParser\Comment\Doc  $docComment) 

Sets the doc comment of the node.

This will either replace an existing doc comment or add it to the comments array.

Parameters

\PhpParser\Comment\Doc $docComment

Doc comment to set

setAttribute()

setAttribute(string  $key, mixed  $value) 

Sets an attribute on a node.

Parameters

string $key
mixed $value

hasAttribute()

hasAttribute(string  $key) : boolean

Returns whether an attribute exists.

Parameters

string $key

Returns

boolean

getAttribute()

getAttribute(string  $key, mixed  $default = null) : mixed

Returns the value of an attribute.

Parameters

string $key
mixed $default

Returns

mixed

getAttributes()

getAttributes() : array

Returns all attributes for the given node.

Returns

array

jsonSerialize()

jsonSerialize() 

getSubNodeNames()

getSubNodeNames() 

fromString()

fromString(string  $str, array  $attributes = array(), boolean  $allowInvalidOctal = false) : \PhpParser\Node\Scalar\LNumber

Constructs an LNumber node from a string number literal.

Parameters

string $str

String number literal (decimal, octal, hex or binary)

array $attributes

Additional attributes

boolean $allowInvalidOctal

Whether to allow invalid octal numbers (PHP 5)

Returns

\PhpParser\Node\Scalar\LNumber

The constructed LNumber, including kind attribute