Open jtojnar opened 3 months ago
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.
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.)
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 isfalse
(default): https://github.com/nette/component-model/commit/7f613eed7f5e57b6bde2d0be1bfdbb7e161620b3It also deprecates the arguments but we cannot add deprecated annotation to those. https://github.com/nette/component-model/commit/4e0946a788b4ac42ea903b761c693ec7dd083a69