| Conditions | 4 |
| Paths | 8 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public static function invalidType( |
||
| 15 | string $propertyName, |
||
| 16 | string $className, |
||
| 17 | string $expectedType, |
||
| 18 | $value |
||
| 19 | ): ValueObjectException { |
||
| 20 | if ($value === null) { |
||
| 21 | $value = 'null'; |
||
| 22 | } |
||
| 23 | |||
| 24 | if (is_object($value)) { |
||
| 25 | $value = get_class($value); |
||
| 26 | } |
||
| 27 | |||
| 28 | if (is_array($value)) { |
||
| 29 | $value = 'array'; |
||
| 30 | } |
||
| 31 | |||
| 32 | return new self("Invalid type: expected {$className}::{$propertyName} to be of type {$expectedType}; instead got value `{$value}`."); |
||
| 33 | } |
||
| 34 | |||
| 40 |