@throws missing from autoPagingIterator()
ZacharyDuBois opened this issue · comments
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](https://private-user-images.githubusercontent.com/2458289/321678302-0f73fa52-3e25-47d0-a0a0-f6b4645bdcf3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4NDc3NDMsIm5iZiI6MTcxOTg0NzQ0MywicGF0aCI6Ii8yNDU4Mjg5LzMyMTY3ODMwMi0wZjczZmE1Mi0zZTI1LTQ3ZDAtYTBhMC1mNmI0NjQ1YmRjZjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDFUMTUyNDAzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjYxOWFiOTJmMmMxNTA0MzU0NTJjZDNkYTJmMzNkMzVhNDBjYTVlZDkyYzdhMmI5YTMwNmQwYjExNDIyMzhkNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.0fkAtpSbwi3iOLg5vwmOqCBPgX5-ClndOiDwr_ZPVnw)
![Screenshot 2024-04-11 at 10 52 02](https://private-user-images.githubusercontent.com/2458289/321678309-5e6f2909-c8a4-4eeb-9b4c-8d23e3e58a3c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4NDc3NDMsIm5iZiI6MTcxOTg0NzQ0MywicGF0aCI6Ii8yNDU4Mjg5LzMyMTY3ODMwOS01ZTZmMjkwOS1jOGE0LTRlZWItOWI0Yy04ZDIzZTNlNThhM2MucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDFUMTUyNDAzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzM5M2M4ZjJlMzU2ZDJhZGU0MjczYjQzYjdhZDgzZTdiZDBjMzkyYWYxNDI3NzdkNDY0NmJkZTI5MDBlYWRjNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.mZJ5hpqXWge4N-DBhMMcEmY_4s1KpBgMlQQDprFidGs)
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](https://private-user-images.githubusercontent.com/2458289/321679678-15c78dd7-5084-42ea-a8e4-bb6b74527690.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4NDc3NDMsIm5iZiI6MTcxOTg0NzQ0MywicGF0aCI6Ii8yNDU4Mjg5LzMyMTY3OTY3OC0xNWM3OGRkNy01MDg0LTQyZWEtYThlNC1iYjZiNzQ1Mjc2OTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDFUMTUyNDAzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODRjZjJlYjkxMDI1ZDAzY2VjNjJkYTYxYmUzNDMyNWJkN2Q3NTExOTA1ZWI0Mzg4OTQzZjg2YWMzZTY5NzA5YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.A44l5HoYdhxjndSrDSYYMDjqre1mv47eQe0ThCpyRbU)
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
Related to #605 but different section of the codebase.
Thanks for reporting @ZacharyDuBois
The fix is out in today's release - version 14.3.0
Wooo! Thank you! Worked over here!