1 | <?php |
||
7 | abstract class AbstractTypeCheck implements TypeCheckInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var bool |
||
11 | */ |
||
12 | protected $isNullable = false; |
||
13 | |||
14 | /** |
||
15 | * @var string[] |
||
16 | */ |
||
17 | protected $types = []; |
||
18 | |||
19 | /** |
||
20 | * @var array<string, string> |
||
21 | */ |
||
22 | private static $typeMapping = [ |
||
23 | 'int' => 'integer', |
||
24 | 'bool' => 'boolean', |
||
25 | 'float' => 'double', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * @return string[] |
||
30 | */ |
||
31 | public function getTypes(): array |
||
32 | { |
||
33 | return $this->types; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param mixed $value |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | 99 | public function checkType(&$value): bool |
|
63 | |||
64 | /** |
||
65 | * @param string $type |
||
66 | * @param mixed $value |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | 99 | protected function assertTypeEquals(string $type, &$value): bool |
|
112 | |||
113 | /** |
||
114 | * @param mixed $value |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 4 | protected function valueToString($value): string |
|
151 | |||
152 | /** |
||
153 | * @param string $type |
||
154 | * @param mixed $collection |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | 16 | private function isValidGenericCollection(string $type, &$collection): bool |
|
174 | } |
||
175 |