@@ -94,7 +94,7 @@ private function get(int $cardId, int $commentId): IComment {
9494 throw new NotFoundException ('No comment found. ' );
9595 }
9696 if ($ comment ->getParentId () !== '0 ' ) {
97- $ this ->permissionService ->checkPermission ($ this ->cardMapper , $ comment ->getParentId (), Acl::PERMISSION_READ );
97+ $ this ->permissionService ->checkPermission ($ this ->cardMapper , ( int ) $ comment ->getParentId (), Acl::PERMISSION_READ );
9898 }
9999
100100 return $ comment ;
@@ -113,24 +113,17 @@ public function getFormatted(int $cardId, int $commentId): array {
113113 }
114114
115115 /**
116- * @param string $cardId
117- * @param string $message
118- * @param string $replyTo
119- * @return DataResponse
120116 * @throws BadRequestException
121117 * @throws NotFoundException|NoPermissionException
122118 */
123- public function create (string $ cardId , string $ message , string $ replyTo = '0 ' ): DataResponse {
124- if (!is_numeric ($ cardId )) {
125- throw new BadRequestException ('A valid card id must be provided ' );
126- }
119+ public function create (int $ cardId , string $ message , string $ replyTo = '0 ' ): DataResponse {
127120 $ this ->permissionService ->checkPermission ($ this ->cardMapper , $ cardId , Acl::PERMISSION_READ );
128121
129122 // Check if parent is a comment on the same card
130123 if ($ replyTo !== '0 ' ) {
131124 try {
132125 $ comment = $ this ->commentsManager ->get ($ replyTo );
133- if ($ comment ->getObjectType () !== Application::COMMENT_ENTITY_TYPE || $ comment ->getObjectId () !== $ cardId ) {
126+ if ($ comment ->getObjectType () !== Application::COMMENT_ENTITY_TYPE || ( int ) $ comment ->getObjectId () !== $ cardId ) {
134127 throw new CommentNotFoundException ();
135128 }
136129 } catch (CommentNotFoundException $ e ) {
@@ -139,7 +132,7 @@ public function create(string $cardId, string $message, string $replyTo = '0'):
139132 }
140133
141134 try {
142- $ comment = $ this ->commentsManager ->create ('users ' , $ this ->userId , Application::COMMENT_ENTITY_TYPE , $ cardId );
135+ $ comment = $ this ->commentsManager ->create ('users ' , $ this ->userId , Application::COMMENT_ENTITY_TYPE , ( string ) $ cardId );
143136 $ comment ->setMessage ($ message );
144137 $ comment ->setVerb ('comment ' );
145138 $ comment ->setParentId ($ replyTo );
0 commit comments