Skip to content

Conversation

@arneee
Copy link
Contributor

@arneee arneee commented Jan 15, 2026

Fix #236

Copilot AI review requested due to automatic review settings January 15, 2026 04:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a type error (issue #236) by making the customer name field nullable in webhook notifications. WhatsApp API webhooks may omit the profile field entirely or send an empty profile object without a name field, which previously caused type errors when attempting to construct Customer objects.

Changes:

  • Made the name property nullable in the Customer class
  • Updated MessageNotificationFactory to use null coalescing operator for missing profile names
  • Added two test cases covering scenarios where profile data is missing

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/WebHook/Notification/Support/Customer.php Changed name property and constructor parameter to nullable string type
src/WebHook/Notification/MessageNotificationFactory.php Added null coalescing operator to handle missing profile.name field
tests/Unit/WebHook/NotificationFactoryTest.php Added tests for empty profile and empty profile name scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type error: Customer::__construct(): Argument #2 ($name) must be of type string, null given. Profile object is optional in webhook.

1 participant