🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

string is mysteriously converted into string|null in foreach with reference #13802

Description

@papparazzo

Bug report

iterating an array of type array<string, string> in a foreach-loop changes the value (reference-type) from string to string|null when calling preg_replace and str_replace
Before phpstan v2.1.32, this code-snippet works very well.

Code snippet that reproduces the problem

https://phpstan.org/r/d9d2635b-2a08-4d46-8aa8-61314551c0f4

Expected output

array<string, string> should be shown in line 24

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

I just couldn’t live without it anymore... ;o)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions