Skip to content

stream_get_contents() only returns FALSE when an invalid offset is provided #3396

Open
phpstan/phpstan-src
#4092
@dktapps

Description

@dktapps

Feature request

PHPStan should recognize that stream_get_contents() does not return FALSE unless an invalid position is provided. Since the position is optional, there are uses of stream_get_contents() where FALSE is never returned.

https://phpstan.org/r/400dcc8f-cb08-4fae-a220-c002120bb05a
https://github.com/php/php-src/blob/3a031e0b03f11b40b8b374472336d9a6df4d81b8/ext/standard/streamsfuncs.c#L448

I'm not quite sure how this problem should be addressed. I already attempted to fix it using overloads in functionMap but didn't succeed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions