Bug report
PHPStan reports that stream_bucket_new returns a resource for PHP < 8. Correct me if I'm wrong, but based on my experience and according to the docs (which admittedly come with a health warning that they are not up to date), it doesn't. It returns an object (just like it does for PHP >= 8).
Code snippet that reproduces the problem
https://phpstan.org/r/7c15e36b-0ea5-4ef9-b3a7-7503df901189
Expected output
No errors for PHP < 8.0, since PHPStan understands that it returns an object.
Did PHPStan help you today? Did it make you happy in any way?
Yes.