forked from vimeo/psalm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEnumCase.php
58 lines (49 loc) · 1.29 KB
/
TEnumCase.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
51
52
53
54
55
56
57
58
<?php
namespace Psalm\Type\Atomic;
/**
* Denotes an enum with a specific value
*/
final class TEnumCase extends TNamedObject
{
/**
* @var string
*/
public $case_name;
public function __construct(string $fq_enum_name, string $case_name)
{
parent::__construct($fq_enum_name);
$this->case_name = $case_name;
}
public function getKey(bool $include_extra = true): string
{
return 'enum(' . $this->value . '::' . $this->case_name . ')';
}
public function getId(bool $exact = true, bool $nested = false): string
{
return 'enum(' . $this->value . '::' . $this->case_name . ')';
}
public function toPhpString(
?string $namespace,
array $aliased_classes,
?string $this_class,
int $analysis_php_version_id
): ?string {
return $this->value;
}
public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool
{
return false;
}
/**
* @param array<lowercase-string, string> $aliased_classes
*
*/
public function toNamespacedString(
?string $namespace,
array $aliased_classes,
?string $this_class,
bool $use_phpdoc_format
): string {
return $this->value . '::' . $this->case_name;
}
}