Skip to content

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

Open
@mind-bending-forks

Description

@mind-bending-forks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions