@@ -214,7 +214,7 @@ public function update($issueIdOrKey, $issueField, $paramArray = [])
214214 * Adds a new comment to an issue.
215215 *
216216 * @param string|int $issueIdOrKey Issue id or key
217- * @param string $comment
217+ * @param Comment $comment
218218 *
219219 * @throws JiraException
220220 * @throws \JsonMapper_Exception
@@ -225,6 +225,10 @@ public function addComment($issueIdOrKey, $comment)
225225 {
226226 $ this ->log ->info ("addComment= \n" );
227227
228+ if (! ($ comment instanceof Comment) || empty ($ comment ->body )) {
229+ throw new JiraException ("comment param must instance of Comment and have to body text.! " );
230+ }
231+
228232 $ data = json_encode ($ comment );
229233
230234 $ ret = $ this ->exec ($ this ->uri ."/ $ issueIdOrKey/comment " , $ data );
@@ -242,7 +246,7 @@ public function addComment($issueIdOrKey, $comment)
242246 *
243247 * @param string|int $issueIdOrKey Issue id or key
244248 * @param string|int $id Comment id
245- * @param string $comment
249+ * @param Comment $comment
246250 *
247251 * @throws JiraException
248252 * @throws \JsonMapper_Exception
@@ -253,6 +257,10 @@ public function updateComment($issueIdOrKey, $id, $comment)
253257 {
254258 $ this ->log ->info ("updateComment= \n" );
255259
260+ if (! ($ comment instanceof Comment) || empty ($ comment ->body )) {
261+ throw new JiraException ("comment param must instance of Comment and have to body text.! " );
262+ }
263+
256264 $ data = json_encode ($ comment );
257265
258266 $ ret = $ this ->exec ($ this ->uri ."/ $ issueIdOrKey/comment/ $ id " , $ data , 'PUT ' );
0 commit comments