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

@throws missing from autoPagingIterator() #1678

Closed
ZacharyDuBois opened this issue Apr 11, 2024 · 3 comments
Closed

@throws missing from autoPagingIterator() #1678

ZacharyDuBois opened this issue Apr 11, 2024 · 3 comments
Labels

Comments

@ZacharyDuBois
Copy link

Describe the bug

Right now, there is now @throws in the PHPDoc for the autoPagingIterator() method. This method makes calls to nextPage() and previousPage() which subsequently both call all() which throws ApiErrorException.

This should be added to all of the parent methods to hint when there is an unhandled exception point in IDEs. Right now, when I wrap an autoPagingIterator() loop in a try { } catch() {} block, there is nothing hinting to the IDE that exceptions can be thrown there.

Screenshot 2024-04-11 at 10 51 48 Screenshot 2024-04-11 at 10 52 02

To Reproduce

Use code snippet below with an IDE with decent PHP language support.

Expected behavior

IDE to complain when there is an unhandled exception.

Screenshot 2024-04-11 at 10 56 06

Code snippets

try {
    foreach ($balanceTransactions->autoPagingIterator() as $balanceTransaction) {
        // Do work
    }
} catch (RateLimitException|ApiErrorException $exception) {
    // IDE thinks this is unreachable/not thrown in anything above.
}

OS

macOS

PHP version

PHP8.3

Library version

13.17.0

API version

2023-10-16

Additional context

Using PhpStorm 2024.1

@ZacharyDuBois
Copy link
Author

Related to #605 but different section of the codebase.

@ramya-stripe
Copy link
Contributor

Thanks for reporting @ZacharyDuBois
The fix is out in today's release - version 14.3.0

@ZacharyDuBois
Copy link
Author

ZacharyDuBois commented Apr 19, 2024

Wooo! Thank you! Worked over here!

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

2 participants