Skip to content

Commit 2ee3e8e

Browse files
committed
fix payload type
1 parent e678177 commit 2ee3e8e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Events/EventTrait.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ public function __construct(object $data)
2525
}
2626

2727
if ($property === "payload") {
28-
$casted_payload = @json_decode($value, true);
29-
if ($casted_payload) {
30-
$this->payload = $casted_payload;
31-
}
28+
$this->payload = match (gettype($value)) {
29+
"object" => (array) $value,
30+
"string" => @json_decode($value, true),
31+
"array" => $value,
32+
};
3233
} else {
3334
$this->$property = $value;
3435
}

0 commit comments

Comments
 (0)