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

Return type of YaLinqo\Enumerable::getIterator() should either be compatible #62

Open
GarciaSiego opened this issue Jan 22, 2024 · 3 comments
Assignees
Labels

Comments

@GarciaSiego
Copy link

Getting following error on php 8.2
Package: "athari/yalinqo": "^2.5",

[message] => Return type of YaLinqo\Enumerable::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [file] => /var/www/html/custom/vendor/athari/yalinqo/YaLinqo/Enumerable.php

@Athari
Copy link
Owner

Athari commented Jan 22, 2024

Wait, is PHP actually making specifying types mandatory? In a minor version? With a hacky commented out attribute to avoid the warning?

Will argument types become mandatory too?

@Athari Athari self-assigned this Jan 22, 2024
@Athari Athari added the type:bug Bug label Jan 22, 2024
@GarciaSiego
Copy link
Author

Simple tag seems to fix it
#63

@Clonkex
Copy link

Clonkex commented Feb 5, 2024

This SO post explains the reasoning quite well. Because they now specify the return type of IteratorAggregate::getIterator(), you now also need to specify the return type on your Enumerable::getIterator(). Rather than instantly break tonnes of older code by specifying return types on built-in classes, they added the #[TentativeType] attribute to give people time to update by causing the deprecation message rather than a straight error.

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

3 participants