Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -34,24 +34,22 @@ class ThrowPromise implements PromiseInterface
/**
* Initializes promise.
*
* @param string|\Exception $exception Exception class name or instance
* @param string|\Exception|\Throwable $exception Exception class name or instance
*
* @throws \Prophecy\Exception\InvalidArgumentException
*/
public function __construct($exception)
{
if (is_string($exception)) {
if (!class_exists($exception)
&& 'Exception' !== $exception
&& !is_subclass_of($exception, 'Exception')) {
if (!class_exists($exception) || !$this->isAValidThrowable($exception)) {
throw new InvalidArgumentException(sprintf(
'Exception class or instance expected as argument to ThrowPromise, but got %s.',
'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.',
$exception
));
}
} elseif (!$exception instanceof \Exception) {
} elseif (!$exception instanceof \Exception && !$exception instanceof \Throwable) {
throw new InvalidArgumentException(sprintf(
'Exception class or instance expected as argument to ThrowPromise, but got %s.',
'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.',
is_object($exception) ? get_class($exception) : gettype($exception)
));
}
@@ -88,4 +86,14 @@ class ThrowPromise implements PromiseInterface
throw $this->exception;
}
/**
* @param string $exception
*
* @return bool
*/
private function isAValidThrowable($exception)
{
return is_a($exception, 'Exception', true) || is_subclass_of($exception, 'Throwable', true);
}
}