Open vudaltsov opened 8 months ago
I found these snippets:
While valid it does open you up to throwing a typeError
https://3v4l.org/kljvE#v8.2.11
Maybe a __destruct
is a safer way to do this?
I found these snippets:
In my code I have it in __destruct
, of course. I copied example above after some experiments. So, yeah, your version is better.
Technically I understand why Psalm is complaining: from Psalm's perspective type changes from resource
to closed-resource
. From PHP's it doesn't.
https://psalm.dev/r/edb33c5ba5https://psalm.dev/r/2540af9e0dThis code works fine:
https://3v4l.org/ZuaRDhttps://3v4l.org/QBFIh