Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Prokyonn committed Sep 29, 2023
1 parent d0f6624 commit a5f32cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Controller/WebsiteCommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public function deleteCommentAction(string $threadId, string $commentId, Request
*/
protected function view($data = null, $statusCode = null, array $headers = [])
{
$view = parent::view($data, intval($statusCode), $headers);
$view = parent::view($data, $statusCode ? (int) $statusCode : null, $headers);

$context = new Context();
$context->setGroups($this->commentSerializationGroups);
Expand Down
5 changes: 2 additions & 3 deletions EventSubscriber/CommentSerializationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ public function onPostSerialize(ObjectEvent $event): void
{
$context = $event->getContext();
/** @var mixed[] $groups */
$groups = $context->getAttribute('groups');
if (!$context->hasAttribute('groups')
|| !in_array('commentWithAvatar', $groups)) {
$groups = $context->hasAttribute('groups') ? $context->getAttribute('groups') : [];
if (!in_array('commentWithAvatar', $groups)) {
return;
}

Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true,
"ocramius/package-versions": true
"php-http/discovery": true
}
}
}

0 comments on commit a5f32cd

Please sign in to comment.