Skip to content

Commit

Permalink
added CommentAware::removeComment()
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 28, 2024
1 parent 9afa824 commit f8a95dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/PhpGenerator/Traits/CommentAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@ public function addComment(string $val): static
$this->comment .= $this->comment ? "\n$val" : $val;
return $this;
}


public function removeComment(): static
{
$this->comment = null;
return $this;
}
}
4 changes: 3 additions & 1 deletion tests/PhpGenerator/ClassType.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ $class->addProperty('handle')
->addComment('@var resource orignal file handle');

$class->addProperty('order')
->setValue(new Literal('RecursiveIteratorIterator::SELF_FIRST'));
->setValue(new Literal('RecursiveIteratorIterator::SELF_FIRST'))
->addComment('foo')
->removeComment();

$class->addProperty('typed1')
->setType(Type::Array)
Expand Down

0 comments on commit f8a95dd

Please sign in to comment.