Skip to content

Commit 732140a

Browse files
committed
Update hostname config
1 parent a2edd12 commit 732140a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/Mailer.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Mailer
9898
* crlf?: string,
9999
* connection_timeout?: int,
100100
* response_timeout?: int,
101-
* hostname?: string,
101+
* hostname?: string|null,
102102
* keep_alive?: bool,
103103
* save_logs?: bool,
104104
* }|string $username
@@ -123,7 +123,7 @@ public function __construct(
123123
'password' => $password,
124124
'host' => $host,
125125
'port' => $port,
126-
'hostname' => $hostname ?? (string) \gethostname(),
126+
'hostname' => $hostname,
127127
]);
128128
}
129129

@@ -154,7 +154,7 @@ public function __destruct()
154154
* crlf?: string,
155155
* connection_timeout?: int,
156156
* response_timeout?: int,
157-
* hostname?: string,
157+
* hostname?: string|null,
158158
* keep_alive?: bool,
159159
* save_logs?: bool,
160160
* } $config
@@ -182,6 +182,7 @@ public function __destruct()
182182
*/
183183
protected function makeConfig(#[SensitiveParameter] array $config) : array
184184
{
185+
$config['hostname'] ??= \gethostname() ?: 'localhost';
185186
$config = \array_replace_recursive(static::DEFAULT_CONFIG, $config);
186187
$this->validateConfigKeys(\array_keys($config));
187188
return $config; // @phpstan-ignore-line

0 commit comments

Comments
 (0)