| Conditions | 3 |
| Paths | 3 |
| Total Lines | 30 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function resolve(): PropertyType |
||
| 30 | { |
||
| 31 | $type = new PropertyType(); |
||
| 32 | |||
| 33 | $docComment = $this->reflection->getDocComment(); |
||
| 34 | |||
| 35 | if (!$docComment) { |
||
| 36 | $type->setNullable(true); |
||
| 37 | |||
| 38 | return $type; |
||
| 39 | } |
||
| 40 | |||
| 41 | preg_match('/\@var ((?:(?:[\w|\\\\])+(?:\[\])?)+)/', $docComment, $matches); |
||
|
|
|||
| 42 | |||
| 43 | if (!count($matches)) { |
||
| 44 | $type->setNullable(true); |
||
| 45 | |||
| 46 | return $type; |
||
| 47 | } |
||
| 48 | |||
| 49 | $varDocComment = end($matches); |
||
| 50 | |||
| 51 | $resolver = new VarTypeResolver($this->reflection); |
||
| 52 | $types = $resolver->resolve($varDocComment); |
||
| 53 | $type->setTypes($types); |
||
| 54 | $type->setArrayTypes(str_replace('[]', '', $types)); |
||
| 55 | $type->setHasType(true); |
||
| 56 | $type->setNullable(strpos($varDocComment, 'null') !== false); |
||
| 57 | |||
| 58 | return $type; |
||
| 59 | } |
||
| 62 |