| @@ 31-35 (lines=5) @@ | ||
| 28 | public function __construct($type) |
|
| 29 | { |
|
| 30 | $checker = "is_{$type}"; |
|
| 31 | if (!function_exists($checker) && !interface_exists($type) && !class_exists($type)) { |
|
| 32 | throw new InvalidArgumentException(sprintf( |
|
| 33 | 'Type or class name expected as an argument to TypeToken, but got %s.', $type |
|
| 34 | )); |
|
| 35 | } |
|
| 36 | ||
| 37 | $this->type = $type; |
|
| 38 | } |
|
| @@ 44-49 (lines=6) @@ | ||
| 41 | public function __construct($exception) |
|
| 42 | { |
|
| 43 | if (is_string($exception)) { |
|
| 44 | if ((!class_exists($exception) && !interface_exists($exception)) || !$this->isAValidThrowable($exception)) { |
|
| 45 | throw new InvalidArgumentException(sprintf( |
|
| 46 | 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', |
|
| 47 | $exception |
|
| 48 | )); |
|
| 49 | } |
|
| 50 | } elseif (!$exception instanceof \Exception && !$exception instanceof \Throwable) { |
|
| 51 | throw new InvalidArgumentException(sprintf( |
|
| 52 | 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', |
|