Skip to content

RemoveNonExistingVarAnnotationRector removes useful comments #7393

@annuh

Description

@annuh

Bug Report

Rector removes some useful @var comments, which were added to make static analysis tools like Psalm and PHPStan happy.

Subject Details
Rector version v0.14.0
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.org/demo/b8211831-e437-4bd9-a844-266787f6d95f

<?php

final class DemoFile
{
    public function run()
    {
        /** @var object{foo: string} $json */
        $json = json_decode('{"foo": "bar"}', false);
    }
}

Responsible rules

  • RemoveNonExistingVarAnnotationRector

Expected Behavior

Rector should not remove this comment, because it's useful for static analysis tools.

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