diff --git a/src/Twilio/TwiML/Comment.php b/src/Twilio/TwiML/Comment.php
new file mode 100644
index 0000000000..30ef84b07a
--- /dev/null
+++ b/src/Twilio/TwiML/Comment.php
@@ -0,0 +1,20 @@
+children as $child) {
if (\is_string($child)) {
$element->appendChild($document->createTextNode($child));
+ } elseif (\is_a($child, \Twilio\TwiML\Comment::class)) {
+ $element->appendChild($document->createComment($child->children[0]));
} else {
$element->appendChild($this->buildElement($child, $document));
}
diff --git a/src/Twilio/TwiML/VoiceResponse.php b/src/Twilio/TwiML/VoiceResponse.php
index 6cb9a059fb..86a4f2adae 100644
--- a/src/Twilio/TwiML/VoiceResponse.php
+++ b/src/Twilio/TwiML/VoiceResponse.php
@@ -219,4 +219,4 @@ public function stop(): Voice\Stop {
public function refer($attributes = []): Voice\Refer {
return $this->nest(new Voice\Refer($attributes));
}
-}
\ No newline at end of file
+}
diff --git a/tests/Twilio/Unit/TwiML/CommentTest.php b/tests/Twilio/Unit/TwiML/CommentTest.php
new file mode 100644
index 0000000000..b9c04a476f
--- /dev/null
+++ b/tests/Twilio/Unit/TwiML/CommentTest.php
@@ -0,0 +1,22 @@
+nest(new Comment('this is a comment'));
+
+ $this->compareXml('', $response);
+ }
+ public function testSketchyCommentToResponse(): void {
+ $response = new VoiceResponse();
+ $response->nest(new Comment('this is --- a sketchy ---- comment'));
+
+ $this->compareXml('', $response);
+ }
+}