Skip to content

How to remove multiline comment? #2864

@oldy777

Description

@oldy777

Hi, I trying to make new rule and stuck with removing multiline comment.
It looks like:

 /**
     * @DI\InjectParams({
     *     "repository" = @DI\Inject("repository"),
     *     "option" = @DI\Inject("%option%"),
     * })
 */

I use

$inf = $constructMethod->getAttribute(AttributeKey::PHP_DOC_INFO);
$inf->removeByName('DI');

but this command removes only 1 line

    ---------- begin diff ----------
--- Original
+++ New
@@ -21,7 +21,6 @@
     /**
-     * @DI\InjectParams({
      *     "repository" = @DI\Inject("repository"),
      *     "option" = @DI\Inject("%option%"),
      * })
    ----------- end diff -----------

Also I tried to make custom TagValueNode, but didn't find a way to registered new PhpDocNodeFactory.

Need help :)
rector version dev-master(v0.7.0)

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