recurly / recurly-client-php

Recurly PHP Client
http://recurly.com
MIT License
172 stars 93 forks source link

TypeError `Recurly\BaseClient::nextPage()`: Return value must be of type `Recurly\Page, Recurly\EmptyResource`returned #787

Open crystinutzaa opened 10 months ago

crystinutzaa commented 10 months ago

Describe the bug

We get an error in our production related to a Type Error due to nextPage() which returns an EmptyResource instead of Recurly/Page resource. This error started to appear suddenly since 2024-01-02 12:58:40 pm GMT+2

To Reproduce

In our production implementation we started to receive the error with this complete stack trace:

TypeError Recurly\BaseClient::nextPage(): Return value must be of type Recurly\Page, Recurly\EmptyResource returned
(Most recent call first)
2 non-project frames
at
(unknown method)(/var/www/vendor/recurly/recurly-client/lib/recurly/base_client.php:143)
Recurly\BaseClient::nextPage(/var/www/vendor/recurly/recurly-client/lib/recurly/pager.php:89)
at
Recurly\Pager::rewind(/var/www/models/classes/Invoices.php:25)

In our implementation we have $invoices = $this->_client->listAccountInvoices('code-' . $account_code);

Expected behavior

Either allow to return Recurly\EmptyResource or return an empty Recurly\Page and address the type error.

Your Environment