Improve robustness: exception consistency, defensive parsing, type safety#17
Merged
Improve robustness: exception consistency, defensive parsing, type safety#17
Conversation
…fety - NoResultException now implements ExceptionInterface (fixes catch-all gap) - ParcelShop::createFromStdClass() uses null-coalescing for optional SOAP properties (Streetname2, Telephone, DistanceMetersAsTheCrowFlies) - Type narrowing via casts and instanceof checks in Client, ParcelShop, and OpeningHours to reduce PHPStan baseline (88 → 83 errors) - Consistent getSoapClient() usage in Client::parseException() - Extract mapParcelShops() helper with proper stdClass type checks - Simplify Client catch blocks (GLS uses 500 for "not found" scenarios) - Add tests for missing optional properties and exception interface
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #17 +/- ##
============================================
+ Coverage 75.71% 83.98% +8.26%
+ Complexity 79 74 -5
============================================
Files 10 10
Lines 210 206 -4
============================================
+ Hits 159 173 +14
+ Misses 51 33 -18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…entFactory - OpeningHoursTest: createFromStdClass parsing and constructor - ResponseTest: 200, 404, 500 status code parsing - ExceptionTest: all 5 exception classes implement ExceptionInterface - SoapClientFactoryTest: creates SoapClient with and without options - Remove standalone NoResultExceptionTest (consolidated into ExceptionTest) Test count: 11 → 22, assertions: 64 → 97
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.
Summary
NoResultExceptionnow implementsExceptionInterface, fixing a gap where it couldn't be caught via the SDK's catch-all interfaceParcelShop::createFromStdClass()uses null-coalescing defaults for optional SOAP properties (Streetname2,Telephone,DistanceMetersAsTheCrowFlies), preventing crashes on incomplete responsesinstanceofchecks across Client, ParcelShop, and OpeningHours reduces PHPStan baseline from 88 → 83 errorsgetSoapClient()usage inClient::parseException()instead of direct property accessmapParcelShops()helper with properstdClasstype checksTest plan
NoResultExceptionTestverifiesExceptionInterfacecontractParcelShopTest::it_parses_class_with_missing_optional_properties