Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub for ob_start missing null type for callback argument for 8.0 <= PHP < 8.4 #113

Open
mind-bending-forks opened this issue Dec 17, 2024 · 0 comments

Comments

@mind-bending-forks
Copy link

mind-bending-forks commented Dec 17, 2024

The stub for ob_start is missing null in the type specification for the $callback argument for 8.0 <= PHP < 8.4.

https://github.com/phpstan/php-8-stubs/blob/main/stubs/ext/standard/ob_start.php

It's not clear if the omission of null from the type specification before 8.4 was deliberate. The docs for PHP do not mention this. They also include an example whereby a null is provided as the value for the $callback argument, which appears to work fine with 8.0 <= PHP < 8.4.

https://www.php.net/manual/en/function.ob-start.php

So this appears to be a bug in the stub. It is causing PHPStan to report incorrect errors against valid code, including against the example provided in the PHP docs:

phpstan/phpstan#12282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant