-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
SplFloat.php
50 lines (44 loc) · 1.06 KB
/
SplFloat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Part of SplTypes package.
*
* (c) Adrien Loyant <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Ducks\Component\SplTypes;
/**
* The SplFloat class is used to enforce strong typing of the float type.
*
* @extends SplType<float>
*
* @psalm-api
*/
class SplFloat extends SplType
{
/**
* @var float
*
* @psalm-suppress InvalidClassConstantType
*/
// phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
protected const __default = 0.0;
/**
* {@inheritdoc}
*
* @param float $initial_value
*
* @SuppressWarnings(PHPMD.CamelCaseParameterName)
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
*/
public function __construct(float $initial_value = self::__default)
{
parent::__construct($initial_value);
}
final public function &__invoke(): float
{
return $this->__default;
}
}