Handle null email in getNameOrEmail() to avoid "Name ()" label

This commit is contained in:
Abderrahim GHAZALI 2026-04-20 12:38:28 +02:00
parent a75fd35347
commit 9a8cdcdd73

View file

@ -93,10 +93,14 @@ class Customer implements CustomerInterface, \Stringable
{
$fullName = $this->getFullName();
if ('' !== $fullName) {
if ('' !== $fullName && null !== $this->email) {
return sprintf('%s (%s)', $fullName, $this->email);
}
if ('' !== $fullName) {
return $fullName;
}
return (string) $this->email;
}