| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function __construct(string $var_name, string $type, array $allowed_types) |
||
| 28 | { |
||
| 29 | switch (\count($allowed_types)) { |
||
| 30 | case 0: |
||
| 31 | throw new \InvalidArgumentException('allowed_types array must not be empty.'); |
||
| 32 | case 1: |
||
| 33 | $msg = '"%s" must be %s but %s found.'; |
||
| 34 | break; |
||
| 35 | default; |
||
| 36 | $msg = '"%s" must be one of allowed types: %s but %s found.'; |
||
| 37 | break; |
||
| 38 | } |
||
| 39 | |||
| 40 | parent::__construct(\sprintf($msg, $var_name, implode(', ', $allowed_types), $type)); |
||
| 41 | } |
||
| 44 |