Skip to content

Commit

Permalink
Merge pull request #387 from JohnVillalovos/jlvillal/str_replace
Browse files Browse the repository at this point in the history
fix: use empty string if value null in a str_replace
  • Loading branch information
effgarces authored Jul 10, 2024
2 parents 363cbc5 + 60dd7b8 commit 8b54261
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Domain/Values/FullName.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct($firstName, $lastName)
if (empty($formatter)) {
$this->fullName = "$firstName $lastName";
} else {
$this->fullName = str_replace('{first}', $firstName, $formatter);
$this->fullName = str_replace('{last}', $lastName, $this->fullName);
$this->fullName = str_replace('{first}', $firstName ?? "", $formatter);
$this->fullName = str_replace('{last}', $lastName ?? "", $this->fullName);
}
}

Expand Down

0 comments on commit 8b54261

Please sign in to comment.