How can I add a new comment? #8448
-
Using a custom rule, I'd like to add comments before certain nodes to signal a need to manually examine the current node. Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
samsonasik
Feb 1, 2024
Replies: 1 comment 4 replies
-
It depends on what you want to achieve, if only add, which means replace if any exists, you can do: $node->setDocComment(new Doc("/** test **/")); ensure that |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
samsonasik
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It depends on what you want to achieve, if only add, which means replace if any exists, you can do:
ensure that
$node
is a\PhpParser\Node\Stmt
instance.