diff --git a/Queueable.php b/Queueable.php index 18f6e90..c9c1e63 100644 --- a/Queueable.php +++ b/Queueable.php @@ -2,13 +2,14 @@ namespace Illuminate\Bus; -use BackedEnum; use Closure; use Illuminate\Queue\CallQueuedClosure; use Illuminate\Support\Arr; use PHPUnit\Framework\Assert as PHPUnit; use RuntimeException; +use function Illuminate\Support\enum_value; + trait Queueable { /** @@ -82,9 +83,7 @@ trait Queueable */ public function onConnection($connection) { - $this->connection = $connection instanceof BackedEnum - ? $connection->value - : $connection; + $this->connection = enum_value($connection); return $this; } @@ -97,9 +96,7 @@ public function onConnection($connection) */ public function onQueue($queue) { - $this->queue = $queue instanceof BackedEnum - ? $queue->value - : $queue; + $this->queue = enum_value($queue); return $this; } @@ -112,9 +109,7 @@ public function onQueue($queue) */ public function allOnConnection($connection) { - $resolvedConnection = $connection instanceof BackedEnum - ? $connection->value - : $connection; + $resolvedConnection = enum_value($connection); $this->chainConnection = $resolvedConnection; $this->connection = $resolvedConnection; @@ -130,9 +125,7 @@ public function allOnConnection($connection) */ public function allOnQueue($queue) { - $resolvedQueue = $queue instanceof BackedEnum - ? $queue->value - : $queue; + $resolvedQueue = enum_value($queue); $this->chainQueue = $resolvedQueue; $this->queue = $resolvedQueue;