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

PHP8.1 deprecated on IteratorAggregate::getIterator() #35

Closed
nono303 opened this issue Nov 6, 2021 · 3 comments
Closed

PHP8.1 deprecated on IteratorAggregate::getIterator() #35

nono303 opened this issue Nov 6, 2021 · 3 comments

Comments

@nono303
Copy link

nono303 commented Nov 6, 2021

Hi,
Currently testing PHP8.1 and I have this deprecated error for all class Requiring interface IteratorAggregate:

\composer\vendor\brick\geo\src\Polygon.php:249;"Return type of Brick\Geo\Polygon::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
\composer\vendor\brick\geo\src\Point.php:331;"Return type of Brick\Geo\Point::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
\composer\vendor\brick\geo\src\LineString.php:274;"Return type of Brick\Geo\LineString::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"

My temporary workaround (see getIterator.patch) was to add ReturnTypeWillChange on all getIterator functions but it may have a better answer to this

@BenMorel
Copy link
Member

BenMorel commented Nov 6, 2021

Hi, thanks for your report. I pushed a commit to master adding an ArrayIterator return type to getIterator(), can you please test if it fixes the deprecation warning?

@nono303
Copy link
Author

nono303 commented Nov 6, 2021

Thx @BenMorel !
Your commit fixes the deprecation warning

@nono303 nono303 closed this as completed Nov 6, 2021
@BenMorel
Copy link
Member

BenMorel commented Nov 6, 2021

Good! Released as 0.7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants