Skip to content

Commit 2eca248

Browse files
committed
Use early return if filename is falsy
1 parent cee040c commit 2eca248

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Attachment.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ public function save(string $path): false|int
8181
*/
8282
public function extension(): ?string
8383
{
84-
if ($ext = pathinfo($this->filename ?? '', PATHINFO_EXTENSION)) {
84+
if (! $this->filename) {
85+
return null;
86+
}
87+
88+
if ($ext = pathinfo($this->filename, PATHINFO_EXTENSION)) {
8589
return $ext;
8690
}
8791

0 commit comments

Comments
 (0)