Make profile / name optional, fixing type error.#237
Open
arneee wants to merge 1 commit intonetflie:mainfrom
Open
Make profile / name optional, fixing type error.#237arneee wants to merge 1 commit intonetflie:mainfrom
arneee wants to merge 1 commit intonetflie:mainfrom
Conversation
There was a problem hiding this comment.
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
nameproperty nullable in theCustomerclass - Updated
MessageNotificationFactoryto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #236