public static function validateAndNormalizeThrowable($throwable, $default) { if ($throwable === null) { if (!self::isThrowable($default)) { throw Exception\NotThrowableException::fromMixed($default, 'Argument 2'); } return $default; } if (!self::isThrowable($throwable)) { throw Exception\NotThrowableException::fromMixed($throwable, 'Throwable'); } return $throwable; }
public function testFromMixedFactoryReturnsException() { $exception = NotThrowableException::fromMixed('string'); $this->assertInstanceOf(NotThrowableException::class, $exception); }