You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two SplObjectStorage instances. The first is acting like a queue and the last is a collection of all foo objects that has been processed. I'm calling SplObjectStorage::removeAll on the queue storage. I would except no errors since both storages have the same types but in the SplObjectStorage stubs in phpstan the removeAll method has doc \SplObjectStorage<object, mixed>. This causes an error reported by phpstan (see the link to phpstan.org). Intuitively I think the doc should \SplObjectStorage<TObject, TData> (which I have not tested). A quick workaround is to use a @var \SplObjectStorage<object, mixed> $remove but that feels dirty...
Bug report
Hey there 👋
I have two SplObjectStorage instances. The first is acting like a queue and the last is a collection of all foo objects that has been processed. I'm calling SplObjectStorage::removeAll on the queue storage. I would except no errors since both storages have the same types but in the SplObjectStorage stubs in phpstan the removeAll method has doc
\SplObjectStorage<object, mixed>
. This causes an error reported by phpstan (see the link to phpstan.org). Intuitively I think the doc should\SplObjectStorage<TObject, TData>
(which I have not tested). A quick workaround is to use a@var \SplObjectStorage<object, mixed> $remove
but that feels dirty...Code snippet that reproduces the problem
https://phpstan.org/r/202b8577-bc06-4f29-bd19-11a91d4fd522
Expected output
No error reported because the same storage types are passed.
Did PHPStan help you today? Did it make you happy in any way?
I use phpstan daily and it's a great tool and I love working with it. :-)
The text was updated successfully, but these errors were encountered: