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

Draft
wants to merge 1 commit into
base: 1.1.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
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
Copy link
Author

jtojnar commented May 18, 2024

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

  173    Parameter1 $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    Parameter1 $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.)

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
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?

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.

None yet

1 participant