Skip to content

Commit

Permalink
fix payload type
Browse files Browse the repository at this point in the history
  • Loading branch information
labi-le committed Jul 13, 2021
1 parent d2515b5 commit 089fde4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
8 changes: 0 additions & 8 deletions src/Events/EventTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ public function __construct(object $data)
$this->chat_id = $value - 2000000000;
}

if ($property === "payload") {
if (is_object($value)) {
$this->payload = $value;
} elseif (is_string($value)) {
$this->payload = json_encode($value, false);
}
}

$this->$property = $value;
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/Events/MessageEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class MessageEvent
private int $peer_id;
private int $user_id;
private int $conversation_message_id;
private object $payload;
private mixed $payload;
private string $event_id;

/**
Expand Down Expand Up @@ -49,9 +49,9 @@ public function getEventId(): string
}

/**
* @return object|null
* @return mixed
*/
public function getPayload(): ?object
public function getPayload(): mixed
{
return $this->getField("payload");
}
Expand Down
6 changes: 3 additions & 3 deletions src/Events/MessageNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MessageNew
private array $attachments;
private bool $important;
private object $geo;
private object $payload;
private mixed $payload;
private array $fwd_messages;
private object $reply_message;
private object $action;
Expand Down Expand Up @@ -135,9 +135,9 @@ public function getGeo(): ?object
}

/**
* @return object|null
* @return mixed
*/
public function getPayload(): ?object
public function getPayload(): mixed
{
return $this->getField("payload");
}
Expand Down

0 comments on commit 089fde4

Please sign in to comment.