Webador / sendcloud

Provides a PHP client to interact with the SendCloud API in an object-oriented way.
MIT License
16 stars 15 forks source link

Return value of JouwWeb\SendCloud\Model\Parcel::JouwWeb\SendCloud\Model\{closure}() must be of the type string, null returned #4

Closed roberthenniger closed 4 years ago

roberthenniger commented 4 years ago

When you create a parcel and call the toArray() function on the resulting parcel it fails with the error:

Return value of JouwWeb\SendCloud\Model\Parcel::JouwWeb\SendCloud\Model{closure}() must be of the type string, null returned

roberthenniger commented 4 years ago

Problem is that wrapper expects an label created to convert an parcel into an array. Sometimes you wanna split these two processes and this won't work with the current version.

roberthenniger commented 4 years ago

Changing jouwweb/sendcloud/src/Model/Parcel.php:299 to 'labels' => array_map(function (int $format): ?string { solves the issue

villermen commented 4 years ago

Thanks for the report and a way of fixing the issue. Sorry for not getting back to you sooner. I didn't have this repository watched yet. I'll fix it and follow up with a minor version bump immediately after that.