SDK throws
mgroensmit opened this issue · 0 comments
I'm getting this error when the validation for the Buckaroo API fails:
Fatal error: Uncaught TypeError: Return value of Buckaroo\Transaction\Request\HttpClient\HttpClientAbstract::getDecodedResult() must be of the type array, null returned in /var/www/html/vendor/buckaroo/sdk/src/Transaction/Request/HttpClient/HttpClientAbstract.php:111
It occurs because the '$result' variable is not a valid stringified JSON object/array in the 'getDecodedResult' function.
Based on the commented out Exception throw I assume this behaviour was at some point identified but somehow overlooked.
In practice, it is off course possible to catch this error when you call the function from the consumer, but if the consumer of this SDK is supposed to catch something, it should: A, be documented in the PHPDOC and B, be an Exception rather than an Error.
Here is a screenshot of my debugger that illustrates the problem, you can see the $result variable is a string that won't result in an array when json_decoded: