Skip to content

Forcing type hint in method forces errror #8999

@PhilippHandle

Description

@PhilippHandle

Bug Report

Rector 2.0.7
PHPStan - PHP Static Analysis Tool 2.1.2

I have this basic example that represents my issue:
https://getrector.com/demo/9b6e60af-2af0-4ccb-b525-38e1fd2edf50

the line $var .= 'test'; forces the signature of $var to string and this gets it missaligned with the trait and phpstan isn't happy about it

https://phpstan.org/r/4c634fd4-544a-4cb5-a8a8-a9c8046a5259

Expected Behaviour

i think that rector tries to guess and add the type is fine, but it should not break the signature from the trait.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions