Conversation
wscourge
commented
Dec 4, 2025
- Update customer methods to accept both positional and array arguments.
- Add null response check and dedicated exception.
There was a problem hiding this comment.
Pull request overview
This PR adds null response handling to the ChartMogul SDK and enhances customer attribute/tag methods to accept both array and positional arguments.
Key Changes:
- Added
NetworkExceptionfor null response scenarios with validation inClientandRetryclasses - Updated customer methods (
addTags,removeTags,addCustomAttributes,removeCustomAttributes,updateCustomAttributes) to accept both array and positional arguments while maintaining backward compatibility
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Exceptions/NetworkException.php |
New exception class for network-related failures |
src/Http/Client.php |
Added null response checks in send() and handleResponse() methods |
src/Http/Retry.php |
Added null result validation for both zero-retry and retry scenarios |
src/Customer.php |
Updated tag and custom attribute methods to support both array and positional arguments |
tests/Unit/Http/ClientNullResponseTest.php |
Tests for null response handling in Client |
tests/Unit/Http/RetryNullHandlingTest.php |
Tests for null response handling in Retry |
tests/Unit/CustomerArrayAttributesTest.php |
Comprehensive tests for new array argument support in customer methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Http/Client.php
Outdated
| public function handleResponse(?ResponseInterface $response) | ||
| { | ||
| // Handle null response | ||
| if ($response === null) { |
There was a problem hiding this comment.
any particular reason why it should be handled like that here? It just looks a little bit weird to allow $response to be null just to raise an exception if it's null.
There was a problem hiding this comment.
@swember as I understand this is the exact underlying issue: right now, we don't recognise null responses and it leads to timeouts. Raising an exception solves this.
I am not an PHP virtuoso though, and I'm very open to different suggestions.