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

Silence deprecation warning on ObjectBag::getIterator method #1115

Closed
wants to merge 1 commit into from

Conversation

hhamon
Copy link
Contributor

@hhamon hhamon commented Jul 14, 2022

On PHP 8.1.7, Sentry captures the following deprecation error with the latest nelmio/alice version:

Deprecated: Return type of Nelmio\Alice\ObjectBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

On PHP 8.1.7, Sentry captures the following deprecation error with the latest `nelmio/alice` version:

> Deprecated: Return type of Nelmio\Alice\ObjectBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
@@ -123,7 +123,8 @@ public function count(): int
{
return count($this->objects);
}


#[\ReturnTypeWillChange]
public function getIterator(): ArrayIterator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it better to replace the return type by : Traversable instead?

@theofidry
Copy link
Member

Closed via #1123

@theofidry theofidry closed this Oct 2, 2022
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

Successfully merging this pull request may close these issues.

2 participants