Merge branch 'master' of https://github.com/pestphp/pest into patch-1

# Conflicts:
#	tests/.snapshots/success.txt
This commit is contained in:
Tom Witkowski
2020-06-21 18:25:57 +02:00
9 changed files with 105 additions and 21 deletions

View File

@ -17,11 +17,15 @@ final class ExceptionTrace
/**
* Ensures the given closure reports
* the good execution context.
*
* @return mixed
*
* @throws \Throwable
*/
public static function ensure(Closure $closure): void
public static function ensure(Closure $closure)
{
try {
$closure();
return $closure();
} catch (Throwable $throwable) {
if (Str::startsWith($message = $throwable->getMessage(), self::UNDEFINED_METHOD)) {
$message = str_replace(self::UNDEFINED_METHOD, 'Call to undefined method ', $message);