1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Type; |
4: | |
5: | use PHPStan\TrinaryLogic; |
6: | |
7: | |
8: | class ClassStringType extends StringType |
9: | { |
10: | |
11: | |
12: | public function __construct() |
13: | { |
14: | parent::__construct(); |
15: | } |
16: | |
17: | public function describe(VerbosityLevel $level): string |
18: | { |
19: | return 'class-string'; |
20: | } |
21: | |
22: | public function accepts(Type $type, bool $strictTypes): TrinaryLogic |
23: | { |
24: | if ($type instanceof CompoundType) { |
25: | return $type->isAcceptedBy($this, $strictTypes); |
26: | } |
27: | |
28: | return $type->isClassStringType(); |
29: | } |
30: | |
31: | public function isSuperTypeOf(Type $type): TrinaryLogic |
32: | { |
33: | if ($type instanceof CompoundType) { |
34: | return $type->isSubTypeOf($this); |
35: | } |
36: | |
37: | return $type->isClassStringType(); |
38: | } |
39: | |
40: | public function isString(): TrinaryLogic |
41: | { |
42: | return TrinaryLogic::createYes(); |
43: | } |
44: | |
45: | public function isNumericString(): TrinaryLogic |
46: | { |
47: | return TrinaryLogic::createMaybe(); |
48: | } |
49: | |
50: | public function isNonEmptyString(): TrinaryLogic |
51: | { |
52: | return TrinaryLogic::createYes(); |
53: | } |
54: | |
55: | public function isNonFalsyString(): TrinaryLogic |
56: | { |
57: | return TrinaryLogic::createYes(); |
58: | } |
59: | |
60: | public function isLiteralString(): TrinaryLogic |
61: | { |
62: | return TrinaryLogic::createMaybe(); |
63: | } |
64: | |
65: | public function isClassStringType(): TrinaryLogic |
66: | { |
67: | return TrinaryLogic::createYes(); |
68: | } |
69: | |
70: | |
71: | |
72: | |
73: | public static function __set_state(array $properties): Type |
74: | { |
75: | return new self(); |
76: | } |
77: | |
78: | } |
79: | |