Skip to content

Mark ob_start() callback parameter nullable #13103

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

Merged

Conversation

haszi
Copy link
Contributor

@haszi haszi commented Jan 9, 2024

Mark the $callback callable parameter of ob_start() as nullable. The parameter is already nullable and is needed for using the default output handler with user-defined chunk_size and/or flags.

@haszi
Copy link
Contributor Author

haszi commented Jan 9, 2024

@kocsismate For your review as this is strictly a stub file change.

@kocsismate
Copy link
Member

Nice catch, thank you!

@kocsismate kocsismate merged commit fed9cf6 into php:master Jan 9, 2024
@haszi haszi deleted the Mark-ob_start-callback-parameter-nullable branch January 11, 2024 11:59
@VincentLanglet
Copy link
Contributor

Hi @kocsismate,

Stubs of PHP 8.0, 8.1, 8.2 and 8.3 branches are currently wrong and some tools like PHPStan are using them.

I know some of these version are EOL but since it's only a stub update would it be ok to backport this PR ?
I can make the PR if it's ok.

@kocsismate
Copy link
Member

@VincentLanglet I can backport it for PHP 8.3 for sure, but we have never done similar changes in EOL or security fix only branches.

AFAIK PHPStan has its own sources of type info besides the official PHP stubs, so they could fix the type info somewhere else.

@kocsismate
Copy link
Member

@VincentLanglet Fix for PHP 8.3: 701f3a1

@VincentLanglet
Copy link
Contributor

Phpstan rely a lot on PHP stub for php 8+ and the override is not always easy.

But it's ok, a fix was made on phpstan to automatically update the phpdoc to add "|null" when the default value is null.

@kocsismate
Copy link
Member

Phpstan rely a lot on PHP stub for php 8+ and the override is not always easy.

Thanks for the info! When I had a discussion with Ondrej a few years ago, he told me that multiple type sources are merged together. But maybe it was related to other symbols, or it's also possible that I didn't exactly understood what he mentioned.

@VincentLanglet
Copy link
Contributor

VincentLanglet commented Apr 15, 2025

Phpstan rely a lot on PHP stub for php 8+ and the override is not always easy.

Thanks for the info! When I had a discussion with Ondrej a few years ago, he told me that multiple type sources are merged together. But maybe it was related to other symbols, or it's also possible that I didn't exactly understood what he mentioned.

Yes, PHPStan rely on multiple source

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

Successfully merging this pull request may close these issues.

3 participants