Skip to content

phpDoc type hints don't work in traits #1294

@iluuu1994

Description

@iluuu1994

PHPStan 0.10.2

Summary of a problem or a feature request

This causes several issues in the new Method signature rule.

Basically, PHPStan only sees the native type hints in methods coming from traits.

Code snippet that reproduces the problem

phpDoc type hint:
https://phpstan.org/r/6deeacd8c9098df919d86a67a2731118

Native type hint:
https://phpstan.org/r/698b43ecb1901190111f1726b6762111

Expected output

I'd expect the same error in both:

Parameter #1 $test of function takesString expects string, int given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions