Skip to content

Commit

Permalink
Fix incorrect assumption in Sticker constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
SunflowerFuchs committed Aug 24, 2022
1 parent 4b79815 commit 0aaf146
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Api/Objects/Sticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Sticker extends StickerItem
/**
* id of the pack the sticker is from
*/
protected Snowflake $pack_id;
protected ?Snowflake $pack_id;
/**
* description of the sticker
*/
Expand Down Expand Up @@ -54,8 +54,8 @@ public function __construct(array $data)
{
parent::__construct($data);

$this->pack_id = new Snowflake($data['pack_id']);
$this->description = $data['description'];
$this->pack_id = isset($data['pack_id']) ? new Snowflake($data['pack_id']) : null;
$this->description = $data['description'] ?? '';
$this->tags = explode(',', $data['tags']);
$this->type = $data['type'];

Expand All @@ -69,7 +69,7 @@ public function __construct(array $data)
/**
* id of the pack the sticker is from
*/
public function getPackId(): Snowflake
public function getPackId(): ?Snowflake
{
return $this->pack_id;
}
Expand Down

0 comments on commit 0aaf146

Please sign in to comment.