Skip to content

Commit

Permalink
Array map require array
Browse files Browse the repository at this point in the history
  • Loading branch information
partydragen committed Mar 24, 2024
1 parent 91763a2 commit 52ad115
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions core/classes/Events/DiscordWebhookBuilder.php
Expand Up @@ -13,7 +13,7 @@ class DiscordWebhookBuilder
private ?string $_avatar_url = null;
private ?string $_content = null;
/** @var DiscordEmbed[] */
private ?array $_embeds = null;
private ?array $_embeds = [];

private function __construct()
{
Expand Down Expand Up @@ -75,10 +75,6 @@ public function getEmbeds(): ?array
*/
public function addEmbed(Closure $closure): self
{
if ($this->_embeds === null) {
$this->_embeds = [];
}

$embed = $closure(new DiscordEmbed());
if (!($embed instanceof DiscordEmbed)) {
throw new RuntimeException('Embed closure must return a DiscordEmbed instance');
Expand Down

0 comments on commit 52ad115

Please sign in to comment.