Bug report
When a call to ob_get_contents() is preceded within the same scope by a call to ob_start() and the value returned by ob_get_contents() is subsequently used in a function expecting string, it will still trigger a warning for passing string|false, while ob_get_contents() will only return false when output buffering is not active and by checking for the call to ob_start() it could be confirmed that output buffering is actually active and that ob_get_contents() will return a string.
Same goes for ob_get_clean() and ob_get_flush() and ob_get_length() (int|false)
Ref: https://www.php.net/manual/en/function.ob-get-contents.php
Code snippet that reproduces the problem
https://phpstan.org/r/9fab3e68-10ae-4c6b-96af-a6718762b2d6
Expected output
None
Did PHPStan help you today? Did it make you happy in any way?
Always and trying to help in return by reporting this issue ;-)
Bug report
When a call to
ob_get_contents()is preceded within the same scope by a call toob_start()and the value returned byob_get_contents()is subsequently used in a function expectingstring, it will still trigger a warning for passingstring|false, whileob_get_contents()will only returnfalsewhen output buffering is not active and by checking for the call toob_start()it could be confirmed that output buffering is actually active and thatob_get_contents()will return astring.Same goes for
ob_get_clean()andob_get_flush()andob_get_length()(int|false)Ref: https://www.php.net/manual/en/function.ob-get-contents.php
Code snippet that reproduces the problem
https://phpstan.org/r/9fab3e68-10ae-4c6b-96af-a6718762b2d6
Expected output
None
Did PHPStan help you today? Did it make you happy in any way?
Always and trying to help in return by reporting this issue ;-)