Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recurly\Pager::key(): Return value must be of type mixed, none returned #786

Open
davedevelopment opened this issue Dec 20, 2023 · 0 comments
Labels

Comments

@davedevelopment
Copy link

Describe the bug

The Pager implements the Iterator interface, but does not meet the contract. If this is a limitation, it could be noted in the docblock comments.

To Reproduce

    // Pager_Test.php

     public function testIteratorComaptability(): void                                                                                                                                                                                                                       
     {                                                                                                                                                                                                                                                                       
         $array = iterator_to_array($this->pager);                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                             
         $this->assertEquals(3, count($array));                                                                                                                                                                                                                              
     }
1) PagerTest::testIteratorComaptability
TypeError: Recurly\Pager::key(): Return value must be of type mixed, none returned

/home/davem/src/recurly-client-php/lib/recurly/pager.php:113
/home/davem/src/recurly-client-php/tests/Pager_Test.php:138

Expected behavior

iterator_to_array($pager) to return an array or the documentation to make it clear that the Pager is not actually an Iterator etc.

Your Environment

  • Which version of this library are you using?
davem@wes:recurly-client-php:v3-v2021-02-25$ git rev-parse HEAD
1a02d110b61a77163027156f574f494fb8c0305e
  • Which version of php are you using?
davem@wes:recurly-client-php:v3-v2021-02-25$ php -v
PHP 8.2.8 (cli) (built: Jul 21 2023 11:32:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant