| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 30 | 2 | public function getTypeByName($type) |
|
| 31 | { |
||
| 32 | 2 | $key = array_search($type, $this->getTypes()); |
|
| 33 | |||
| 34 | 2 | if (false !== $key) { |
|
| 35 | 1 | return $key; |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | throw new \Exception(sprintf( |
|
| 39 | 1 | 'Type: "%s" not found, allowed %s', |
|
| 40 | 1 | $type, |
|
| 41 | 1 | implode(', ', $this->getTypes()) |
|
| 42 | 1 | )); |
|
| 43 | } |
||
| 44 | |||
| 64 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.