name = $name; $this->type = $type; $this->businessId = $businessId; } public function id(): ?int { return $this->id; } public function name(): CustomerName { return $this->name; } public function type(): CustomerType { return $this->type; } public function businessId(): ?BusinessId { return $this->businessId; } private static function ensureBusinessIdFitsType(CustomerType $type, ?BusinessId $businessId): void { if ($type === CustomerType::Consumer && $businessId !== null) { throw new ConsumerCannotHaveBusinessId; } } }