Skip to content

stream_context_get_params(): too loose signature? #11796

@ThomasLandauer

Description

@ThomasLandauer

Bug report

The question is if stream_context_get_params() returns an array with key options for sure, or not.
PHPStan says no: https://phpstan.org/r/d7e17de1-65c5-412f-bcd1-ce04b797a1f3
Psalm says yes: https://psalm.dev/r/84991be58a

I submitted a PR for PHP docs to include false as possible return type, but it got rejected (at least for PHP 8+): php/doc-en#3824
So putting all this together, I think you should adjust the signature of stream_context_get_params() to always output options (which is an array too).

Code snippet that reproduces the problem

No response

Expected output

No issue.

Did PHPStan help you today? Did it make you happy in any way?

Yes! :-)

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