Skip to content

Commit db39466

Browse files
committed
Properly return null when there is no reply to address
Closes #6
1 parent 2f32cff commit db39466

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Message.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,31 +124,31 @@ public function subject(): ?string
124124
*/
125125
public function from(): ?Address
126126
{
127-
return head($this->addresses(HeaderConsts::FROM));
127+
return head($this->addresses(HeaderConsts::FROM)) ?: null;
128128
}
129129

130130
/**
131131
* Get the SENDER address.
132132
*/
133133
public function sender(): ?Address
134134
{
135-
return head($this->addresses(HeaderConsts::SENDER));
135+
return head($this->addresses(HeaderConsts::SENDER)) ?: null;
136136
}
137137

138138
/**
139139
* Get the REPLY-TO address.
140140
*/
141141
public function replyTo(): ?Address
142142
{
143-
return head($this->addresses(HeaderConsts::REPLY_TO));
143+
return head($this->addresses(HeaderConsts::REPLY_TO)) ?: null;
144144
}
145145

146146
/**
147147
* Get the IN-REPLY-TO address.
148148
*/
149149
public function inReplyTo(): ?Address
150150
{
151-
return head($this->addresses(HeaderConsts::IN_REPLY_TO));
151+
return head($this->addresses(HeaderConsts::IN_REPLY_TO)) ?: null;
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)