public function ThrowPromise::__construct in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php \Prophecy\Promise\ThrowPromise::__construct()
Initializes promise.
Parameters
string|\Exception $exception Exception class name or instance:
Throws
\Prophecy\Exception\InvalidArgumentException
File
- vendor/
phpspec/ prophecy/ src/ Prophecy/ Promise/ ThrowPromise.php, line 41
Class
- ThrowPromise
- Throw promise.
Namespace
Prophecy\PromiseCode
public function __construct($exception) {
if (is_string($exception)) {
if (!class_exists($exception) && 'Exception' !== $exception && !is_subclass_of($exception, 'Exception')) {
throw new InvalidArgumentException(sprintf('Exception class or instance expected as argument to ThrowPromise, but got %s.', gettype($exception)));
}
}
elseif (!$exception instanceof \Exception) {
throw new InvalidArgumentException(sprintf('Exception class or instance expected as argument to ThrowPromise, but got %s.', gettype($exception)));
}
$this->exception = $exception;
}