Skip to content

Commit f8a95dd

Browse files
committed
added CommentAware::removeComment()
1 parent 9afa824 commit f8a95dd

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/PhpGenerator/Traits/CommentAware.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,11 @@ public function addComment(string $val): static
3939
$this->comment .= $this->comment ? "\n$val" : $val;
4040
return $this;
4141
}
42+
43+
44+
public function removeComment(): static
45+
{
46+
$this->comment = null;
47+
return $this;
48+
}
4249
}

tests/PhpGenerator/ClassType.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ $class->addProperty('handle')
5959
->addComment('@var resource orignal file handle');
6060

6161
$class->addProperty('order')
62-
->setValue(new Literal('RecursiveIteratorIterator::SELF_FIRST'));
62+
->setValue(new Literal('RecursiveIteratorIterator::SELF_FIRST'))
63+
->addComment('foo')
64+
->removeComment();
6365

6466
$class->addProperty('typed1')
6567
->setType(Type::Array)

0 commit comments

Comments
 (0)