Skip to content

Commit

Permalink
Fix invalid assumption in Emoji constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
SunflowerFuchs committed Aug 24, 2022
1 parent 6e0cfa2 commit c682505
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Api/Objects/Emoji.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Emoji
* role ids this emoji is whitelisted to
* @var int[]
*/
protected ?array $roles;
protected array $roles;
/**
* object user that created this emoji
*/
Expand Down Expand Up @@ -57,9 +57,7 @@ public function __construct(array $data)
$this->managed = $data['managed'] ?? false;
$this->animated = $data['animated'] ?? false;
$this->available = $data['available'] ?? true;

$this->roles = array_map(fn(array $roleData) => new Role($roleData),
$data['roles'] ?? []);
$this->roles = $data['roles'] ?? [];
}

/**
Expand Down Expand Up @@ -251,7 +249,7 @@ public function getName(): ?string
*
* @return int[]
*/
public function getRoles(): ?array
public function getRoles(): array
{
return $this->roles;
}
Expand Down

0 comments on commit c682505

Please sign in to comment.