Skip to content

VarInlineAnnotationToAssertRector will almost always end up with failed assertions. #2118

@noximo

Description

@noximo

VarInlineAnnotationToAssertRector currently replace @var phpdoc with assertion on the same line. This will lead to a failed assertion because variable is usually defined on the line below and is thus undefined at the time of assert.

Therefore line containing the variable definiton and assertion should be swapped.

Also code sample in this rector is invalid - there's a method call on an undefined variable that would result in error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions