-<?php
+<?php declare(strict_types=1);
namespace PhpParser\Node\Scalar;
* @param float $value Value of the number
* @param array $attributes Additional attributes
*/
- public function __construct($value, array $attributes = array()) {
+ public function __construct(float $value, array $attributes = []) {
parent::__construct($attributes);
$this->value = $value;
}
- public function getSubNodeNames() {
- return array('value');
+ public function getSubNodeNames() : array {
+ return ['value'];
}
/**
*
* @return float The parsed number
*/
- public static function parse($str) {
+ public static function parse(string $str) : float {
// if string contains any of .eE just cast it to float
if (false !== strpbrk($str, '.eE')) {
return (float) $str;
// dec
return (float) $str;
}
+
+ public function getType() : string {
+ return 'Scalar_DNumber';
+ }
}