wirecardBrasil/moip-sdk-php

[TRANSFERS] Calling `setHolder` before `setTransfers` causes a warning.

Closed this issue · 0 comments

In setHolder there's a reference to transferInstrument, which is instantiated in setTransfers.

https://github.com/moip/moip-sdk-php/blob/8b13518d19cc4f8ab8285357f05c4d6d0d57da07/src/Resource/Transfers.php#L93-L100

If this method is called before setTransfers, it will trigger a warning.


How to fix?

Both setHolder and setTransfers need to check for the existence of $this->data->transferInstrument - if it doesn't exist, it is instantiated. (Otherwise, it would override the existing data)