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

Update ComponentModel\Container stub for component-model 3.1.0 #142

Open
wants to merge 2 commits into
base: 2.0.x
Choose a base branch
from

Conversation

jtojnar
Copy link

@jtojnar jtojnar commented May 18, 2024

That version changes the return type to array when $deep argument is false (default):
nette/component-model@7f613ee

It also deprecates the arguments but we cannot add deprecated annotation to those.
nette/component-model@4e0946a

@jtojnar jtojnar force-pushed the cm-container-3.1 branch 2 times, most recently from ed45fb8 to 11e9969 Compare May 18, 2024 12:18
@jtojnar
Copy link
Author

jtojnar commented May 18, 2024

It also deprecates the arguments but we cannot add deprecated annotation to those.

There is no @param-deprecated annotation AFAICT and the upcoming #[Deprecated] attribute RFC leaves it up for future.

@jtojnar jtojnar marked this pull request as draft May 18, 2024 12:22
@jtojnar jtojnar force-pushed the cm-container-3.1 branch from 11e9969 to 4a7f493 Compare May 18, 2024 12:24
@jtojnar
Copy link
Author

jtojnar commented May 18, 2024

Looks like this is recognized properly, as I no longer get

  173    Parameter #1 $array of function array_filter expects array, Iterator<int|string, Nette\ComponentModel\IComponent> given.  

But for some reason it now thinks it returns the union of both branches:

  173    Parameter #1 $array of function array_filter expects array, array<int|string, Nette\ComponentModel\IComponent>|Iterator<int|string, Nette\ComponentModel\IComponent> given.  

(This is with PHPStan 1.11.1.)

@jtojnar jtojnar force-pushed the cm-container-3.1 branch from 4a7f493 to 5113331 Compare May 18, 2024 12:34
@jtojnar
Copy link
Author

jtojnar commented May 18, 2024

I tried to reproduce it in Playground but it does not fail there: https://phpstan.org/r/50c723fc-6a84-4ca3-945d-fdc4fc5f9fbc

Possibly this is some difference in how stubs are handled?

That version changes the return type to array when `$deep` argument is `false` (default):
nette/component-model@7f613ee

It also deprecates the arguments but we cannot add deprecated annotation to those.
nette/component-model@4e0946a
@jtojnar jtojnar changed the base branch from 1.1.x to 2.0.x January 11, 2025 10:49
@jtojnar jtojnar marked this pull request as ready for review January 11, 2025 10:55
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.

1 participant