generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9e0655
commit 3b2f67d
Showing
3 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Spatie\Backtrace\Tests\TestClasses; | ||
|
||
use Exception; | ||
use Laravel\SerializableClosure\SerializableClosure; | ||
use Throwable; | ||
|
||
class LaravelSerializableClosureCallThrow | ||
{ | ||
public static function getThrowable(): Throwable | ||
{ | ||
$closure = function () { | ||
self::throw(); | ||
}; | ||
|
||
$serialized = serialize(new SerializableClosure($closure)); | ||
$closure = unserialize($serialized)->getClosure(); | ||
|
||
try { | ||
$closure(); | ||
} catch (Throwable $exception) { | ||
return $exception; | ||
} | ||
} | ||
|
||
public static function throw() | ||
{ | ||
throw new Exception('This is a test exception from a serialized closure'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters