name); $email = $data->email === null ? null : new EmailAddress($data->email); $this->transactions->run(function () use ($customerId, $contactId, $name, $email, $data): void { $contact = $this->contacts->findForCustomer($customerId, $contactId) ?? throw new ContactNotFound($customerId, $contactId); $contact->changeDetails($name, $data->title, $data->phone, $email, $data->note); $this->contacts->save($contact); }); } }