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: | return $this->acceptsWithReason($type, $strictTypes)->result; |
25: | } |
26: | |
27: | public function acceptsWithReason(Type $type, bool $strictTypes): AcceptsResult |
28: | { |
29: | if ($type instanceof CompoundType) { |
30: | return $type->isAcceptedWithReasonBy($this, $strictTypes); |
31: | } |
32: | |
33: | return new AcceptsResult($type->isClassStringType(), []); |
34: | } |
35: | |
36: | public function isSuperTypeOf(Type $type): TrinaryLogic |
37: | { |
38: | if ($type instanceof CompoundType) { |
39: | return $type->isSubTypeOf($this); |
40: | } |
41: | |
42: | return $type->isClassStringType(); |
43: | } |
44: | |
45: | public function isString(): TrinaryLogic |
46: | { |
47: | return TrinaryLogic::createYes(); |
48: | } |
49: | |
50: | public function isNumericString(): TrinaryLogic |
51: | { |
52: | return TrinaryLogic::createMaybe(); |
53: | } |
54: | |
55: | public function isNonEmptyString(): TrinaryLogic |
56: | { |
57: | return TrinaryLogic::createYes(); |
58: | } |
59: | |
60: | public function isNonFalsyString(): TrinaryLogic |
61: | { |
62: | return TrinaryLogic::createYes(); |
63: | } |
64: | |
65: | public function isLiteralString(): TrinaryLogic |
66: | { |
67: | return TrinaryLogic::createMaybe(); |
68: | } |
69: | |
70: | public function isClassStringType(): TrinaryLogic |
71: | { |
72: | return TrinaryLogic::createYes(); |
73: | } |
74: | |
75: | public function getClassStringObjectType(): Type |
76: | { |
77: | return new ObjectWithoutClassType(); |
78: | } |
79: | |
80: | public function getObjectTypeOrClassStringObjectType(): Type |
81: | { |
82: | return new ObjectWithoutClassType(); |
83: | } |
84: | |
85: | |
86: | |
87: | |
88: | public static function __set_state(array $properties): Type |
89: | { |
90: | return new self(); |
91: | } |
92: | |
93: | } |
94: | |