Skip to content

Iconv + ArrayAccess #2268

@msvrtan

Description

@msvrtan

Bug report

Seems phpstan is bit confused by implementation of offsetSet on ArrayAccess if there is a possibility to set an invalid value.

We have a Message (3rd party object) that says both key and value should be strings, but iconv can return a false|string and the problem was on another place where it was complaining that

Parameter #1 $data of method SomeController::paymentRefund() expects Message, ()|(Message) given. on Line 18 (using value from snippet)

Code snippet that reproduces the problem

https://phpstan.org/r/147b81cf-47f5-4c84-85d0-030583fc673e

Expected output

I would expect the problem to be You cant put false where string is expected on Line 13 (using value from snippet)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions