-
Notifications
You must be signed in to change notification settings - Fork 650
/
TLiteralInt.php
49 lines (41 loc) · 1.01 KB
/
TLiteralInt.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
<?php
namespace Psalm\Type\Atomic;
/**
* Denotes an integer value where the exact numeric value is known.
*/
final class TLiteralInt extends TInt
{
/** @var int */
public $value;
public function __construct(int $value)
{
$this->value = $value;
}
public function getKey(bool $include_extra = true): string
{
return 'int(' . $this->value . ')';
}
public function getId(bool $exact = true, bool $nested = false): string
{
if (!$exact) {
return 'int';
}
return (string) $this->value;
}
public function getAssertionString(): string
{
return 'int(' . $this->value . ')';
}
/**
* @param array<lowercase-string, string> $aliased_classes
*
*/
public function toNamespacedString(
?string $namespace,
array $aliased_classes,
?string $this_class,
bool $use_phpdoc_format
): string {
return $use_phpdoc_format ? 'int' : (string) $this->value;
}
}