Skip to content

Variable type passed to method/function by reference becomes mixed #4372

@b1rdex

Description

@b1rdex

Bug report

Parameters passed by ref acquire mixed type. The type should be taken from the method/function signature.

Code snippet that reproduces the problem

https://phpstan.org/r/ddd38952-fe62-4dc4-9d13-ed9aa83ca89c

Expected output

Type = array, error reported for array to string conversion.

This is covered by psalm: https://psalm.dev/r/82e99bda64
Also, there is @param-out annotation that allows to specify the result type.

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