Skip to content

Typehint not trusted if code is inside method #4352

@InvisibleSmiley

Description

@InvisibleSmiley

Bug report

If PHPStan is instructed to trust typehints, it does it only for top-level code, not for code inside a method.

Code snippet that reproduces the problem

https://phpstan.org/r/08e5a1cd-bb50-45c5-ab70-b5530b2815dd

Expected output

PHPStan should trust the typehint if it is instructed to do so.
The dependency between the two variables is another issue that doesn't need to be resolved here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions