Skip to content

Update the schema stub to use iterable for the fields and filters #308

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

shanginn
Copy link

In the core/src/Core/Schema/Schema.php both fields and filters returns iterable, but stubs still generate them as arrays:

abstract public function fields(): iterable;

public function filters(): iterable

…rs methods, enhancing type consistency and clarity. Additionally, include the Filter contract for improved functionality.
@lindyhopchris
Copy link
Contributor

Thanks for the PR. I'm not sure it needs to be iterable as the generated schema is returning an array, and array is allowed as the return type as it is a covariant.

Do you have a specific reason for changing this? I.e. are you not returning array from those methods?

@shanginn
Copy link
Author

yeah, you are right, array is a covariant of iterable. all I want to do is make PHPStan happy with the default generated schemas.
how about this then? Just add iterable type to the phpdoc?

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