Skip to content

@var variable not found if initialized in a test #7934

@jolan78

Description

@jolan78

Bug report

when a variable designated in a @var type $variable phpdoc comment is initialized in a test, phpstan fails to find it :
Variable $variable in PHPDoc tag @var does not exist.

Code snippet that reproduces the problem

https://phpstan.org/r/9566e566-3fb7-40a3-9620-fb08ab0791b1

Expected output

no error

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

Absolutely ! my code gets cleaner and is is satisfying.

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