From ae0cee876adce15f27b420c7e56956908d9105e5 Mon Sep 17 00:00:00 2001 From: Dawid Parafinski Date: Wed, 18 Sep 2024 16:26:11 +0200 Subject: [PATCH] Fixed phpstan issues --- phpstan-baseline.neon | 5 ----- src/lib/Server/Controller/User.php | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 079fac3f..a019f667 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1750,11 +1750,6 @@ parameters: count: 1 path: src/lib/Server/Controller/User.php - - - message: "#^Parameter \\#1 \\$versions of class Ibexa\\\\Rest\\\\Server\\\\Values\\\\VersionList constructor expects array\\, iterable\\ given\\.$#" - count: 1 - path: src/lib/Server/Controller/User.php - - message: "#^Parameter \\#5 \\$relations of class Ibexa\\\\Rest\\\\Server\\\\Values\\\\RestUser constructor expects array\\, iterable\\ given\\.$#" count: 5 diff --git a/src/lib/Server/Controller/User.php b/src/lib/Server/Controller/User.php index a16c07ec..7661ad59 100644 --- a/src/lib/Server/Controller/User.php +++ b/src/lib/Server/Controller/User.php @@ -584,10 +584,10 @@ public function loadUserDrafts(int $userId, Request $request): Values\VersionLis ); return new Values\VersionList( - array_map( - static fn (ContentDraftListItemInterface $draftListItem): VersionInfo => $draftListItem->getVersionInfo(), + array_filter(array_map( + static fn (ContentDraftListItemInterface $draftListItem): ?VersionInfo => $draftListItem->getVersionInfo(), $contentDrafts->items - ), + )), $request->getPathInfo() ); }