1 | <?php |
||
19 | final class PhpDocTypeGuesser implements FormTypeGuesserInterface |
||
20 | { |
||
21 | /** @var string[] */ |
||
22 | private static $typeMap = [ |
||
23 | 'int' => IntegerType::class, |
||
24 | 'integer' => IntegerType::class, |
||
25 | 'string' => TextType::class, |
||
26 | 'float' => NumberType::class, |
||
27 | 'double' => NumberType::class, |
||
28 | 'real' => NumberType::class, |
||
29 | 'boolean' => CheckboxType::class, |
||
30 | 'bool' => CheckboxType::class, |
||
31 | 'array' => CollectionType::class, |
||
32 | ]; |
||
33 | /** @var DocBlockFactory */ |
||
34 | private $factory; |
||
35 | |||
36 | /** |
||
37 | * PhpDocTypeGuesser constructor. |
||
38 | */ |
||
39 | 6 | public function __construct() |
|
43 | |||
44 | /** {@inheritdoc} */ |
||
45 | 6 | public function guessType($class, $property) |
|
78 | |||
79 | /** {@inheritdoc} */ |
||
80 | 6 | public function guessRequired($class, $property) |
|
84 | |||
85 | /** {@inheritdoc} */ |
||
86 | 6 | public function guessMaxLength($class, $property) |
|
89 | |||
90 | /** {@inheritdoc} */ |
||
91 | 6 | public function guessPattern($class, $property) |
|
94 | |||
95 | /** |
||
96 | * @param string $class |
||
97 | * @param string $property |
||
98 | * |
||
99 | * @return Var_ |
||
100 | */ |
||
101 | 6 | private function readPhpDocAnnotations($class, $property) |
|
112 | |||
113 | /** |
||
114 | * @param string $type |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 6 | private function replaceType($type) |
|
126 | |||
127 | /** |
||
128 | * @param string $type |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | 6 | private function exists($type) |
|
136 | } |
||
137 |