From 84ffd0ff1802cdb6fec6e4aa17489e31647b5725 Mon Sep 17 00:00:00 2001 From: Pavlico Date: Wed, 15 Sep 2021 12:11:35 +0200 Subject: [PATCH] Fix null params --- src/Api/MailingList.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Api/MailingList.php b/src/Api/MailingList.php index e87f607..116af85 100644 --- a/src/Api/MailingList.php +++ b/src/Api/MailingList.php @@ -58,15 +58,16 @@ class MailingList extends HttpApi * Creates a new mailing list on the current domain. * * @param string $address Address for the new mailing list - * @param string $name Name for the new mailing list (optional) - * @param string $description Description for the new mailing list (optional) + * @param string|null $name Name for the new mailing list (optional) + * @param string|null $description Description for the new mailing list (optional) * @param string $accessLevel List access level, one of: readonly (default), members, everyone - * + * @param string $replyPreference + * * @return CreateResponse * * @throws \Exception */ - public function create(string $address, string $name = null, string $description = null, string $accessLevel = 'readonly', string $replyPreference = 'list') + public function create(string $address, ?string $name = null, ?string $description = null, string $accessLevel = 'readonly', string $replyPreference = 'list') { Assert::stringNotEmpty($address); Assert::nullOrStringNotEmpty($name); @@ -76,11 +77,11 @@ class MailingList extends HttpApi $params = [ 'address' => $address, - 'name' => $name, - 'description' => $description, 'access_level' => $accessLevel, 'reply_preference' => $replyPreference, ]; + $description ? $params['description'] = $description : false; + $name ? $params['name'] = $name : false; $response = $this->httpPost('/v3/lists', $params);