-<?php
+<?php declare(strict_types=1);
namespace PhpParser\Node\Scalar;
* @param int $value Value of the number
* @param array $attributes Additional attributes
*/
- public function __construct($value, array $attributes = array()) {
+ public function __construct(int $value, array $attributes = []) {
parent::__construct($attributes);
$this->value = $value;
}
- public function getSubNodeNames() {
- return array('value');
+ public function getSubNodeNames() : array {
+ return ['value'];
}
/**
*
* @return LNumber The constructed LNumber, including kind attribute
*/
- public static function fromString($str, array $attributes = array(), $allowInvalidOctal = false) {
+ public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false) : LNumber {
if ('0' !== $str[0] || '0' === $str) {
$attributes['kind'] = LNumber::KIND_DEC;
return new LNumber((int) $str, $attributes);
$attributes['kind'] = LNumber::KIND_OCT;
return new LNumber(intval($str, 8), $attributes);
}
+
+ public function getType() : string {
+ return 'Scalar_LNumber';
+ }
}