+
Skip to content

List should be evaluated strict #3311

@boesing

Description

@boesing

Feature request

If I declare a list with @psalm- prefix like the following annotation, I would think, phpstan wont let us write random array keys without giving an error:

/**
 * @var array<int, string>
 * @psalm-var list<string>
 */

Code snippet that reproduces the problem

https://phpstan.org/r/e0cb84f3-4949-4b2b-822a-bd3f0e6e517a
https://phpstan.org/r/310c5806-540e-4202-a3b3-785e42daa0f6

Expected output

Something like "Foo::$bar was expected to be a list of strings, non-list given" or something like this. 🤷

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

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载