DKE-Data / agrirouter-sdk-php

This project contains the SDK for the communication with the agrirouter. Everything you need for the onboarding process, secure communication and much more.
Apache License 2.0
2 stars 3 forks source link

Set default array to OutboxResponse messages in order to fix error ac… #43

Closed germanow closed 3 years ago

germanow commented 3 years ago

When service respond with string "[]", $outboxService->fetch() returns OutboxResponse with not initialized messages. It causes error when trying to access $outboxResponse->getMessages():

Exception 'Error' with message 'Typed property App\Dto\Messaging\Http\OutboxResponse::$messages must not be accessed before initialization'

There is no way to detect empty response to prevent php error.

Setting default value fix this situation.