Skip to content

Commit

Permalink
[11.x] Add Illuminate\Support\enum_value to resolve BackedEnum or…
Browse files Browse the repository at this point in the history
… `UnitEnum` to scalar (#53096)

* [11.x] Add `Illuminate\Support\mutate` to resolve `BackedEnum` or
`UnitEnum` to scalar.

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Apply fixes from StyleCI

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Apply fixes from StyleCI

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Apply fixes from StyleCI

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

* Apply fixes from StyleCI

* rename to scalar value

* rename again

---------

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
3 people authored Oct 11, 2024
1 parent 96d0fba commit ed8d93d
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Queueable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit ed8d93d

Please sign in to comment.