From 203853c4d65b73267e9559579b8bc49135f05c77 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Fri, 8 Nov 2024 10:24:44 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł Niedzielski Co-authored-by: Konrad Oboza --- eZ/Publish/Core/Repository/BookmarkService.php | 4 +++- .../Core/Repository/Tests/Service/Mock/BookmarkTest.php | 2 +- .../Values/Content/Query/Criterion/IsBookmarked.php | 5 ++--- .../Values/Content/Query/SortClause/BookmarkId.php | 4 ++-- .../Bookmark/IdSortClauseQueryBuilder.php | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/eZ/Publish/Core/Repository/BookmarkService.php b/eZ/Publish/Core/Repository/BookmarkService.php index 1d13afc8d1..2b97b20496 100644 --- a/eZ/Publish/Core/Repository/BookmarkService.php +++ b/eZ/Publish/Core/Repository/BookmarkService.php @@ -113,7 +113,9 @@ public function loadBookmarks(int $offset = 0, int $limit = 25): BookmarkList $result = $this->repository->getlocationService()->find($filter, []); } catch (BadStateException $e) { - $this->logger->debug($e); + $this->logger->debug($e, [ + 'exception' => $e, + ]); return new BookmarkList(); } diff --git a/eZ/Publish/Core/Repository/Tests/Service/Mock/BookmarkTest.php b/eZ/Publish/Core/Repository/Tests/Service/Mock/BookmarkTest.php index 4150f4351f..8c23c0dbfc 100644 --- a/eZ/Publish/Core/Repository/Tests/Service/Mock/BookmarkTest.php +++ b/eZ/Publish/Core/Repository/Tests/Service/Mock/BookmarkTest.php @@ -224,7 +224,7 @@ public function testLoadBookmarks() $locationServiceMock = $this->createMock(LocationService::class); $locationServiceMock - ->expects($this->once()) + ->expects(self::once()) ->method('find') ->willReturn($locationList); diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/IsBookmarked.php b/src/contracts/Repository/Values/Content/Query/Criterion/IsBookmarked.php index bfea9c0cda..15be989a8d 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/IsBookmarked.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/IsBookmarked.php @@ -16,16 +16,15 @@ /** * A criterion that matches locations of bookmarks for a given user id. * - * * Supported operators: * - EQ: matches against a unique user id */ -class IsBookmarked extends Criterion implements FilteringCriterion +final class IsBookmarked extends Criterion implements FilteringCriterion { /** * Creates a new IsBookmarked criterion. * - * @param int $value UserID for which bookmarked locations must be matched against + * @param int $value user id for which bookmarked locations must be matched against * * @throws \InvalidArgumentException if a non numeric id is given * @throws \InvalidArgumentException if the value type doesn't match the operator diff --git a/src/contracts/Repository/Values/Content/Query/SortClause/BookmarkId.php b/src/contracts/Repository/Values/Content/Query/SortClause/BookmarkId.php index 3574b68695..b00d4488d4 100644 --- a/src/contracts/Repository/Values/Content/Query/SortClause/BookmarkId.php +++ b/src/contracts/Repository/Values/Content/Query/SortClause/BookmarkId.php @@ -13,9 +13,9 @@ use eZ\Publish\SPI\Repository\Values\Filter\FilteringSortClause; /** - * Sets sort direction on the Bookmark ID for a location query containing a IsBookmarked criterion. + * Sets sort direction on the bookmark id for a location query containing IsBookmarked criterion. */ -class BookmarkId extends SortClause implements FilteringSortClause +final class BookmarkId extends SortClause implements FilteringSortClause { public function __construct(string $sortDirection = Query::SORT_ASC) { diff --git a/src/lib/Persistence/Legacy/Filter/SortClauseQueryBuilder/Bookmark/IdSortClauseQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/SortClauseQueryBuilder/Bookmark/IdSortClauseQueryBuilder.php index 0e5613b91b..e9859519b8 100644 --- a/src/lib/Persistence/Legacy/Filter/SortClauseQueryBuilder/Bookmark/IdSortClauseQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/SortClauseQueryBuilder/Bookmark/IdSortClauseQueryBuilder.php @@ -13,7 +13,7 @@ use eZ\Publish\SPI\Repository\Values\Filter\SortClauseQueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\BookmarkId; -class IdSortClauseQueryBuilder implements SortClauseQueryBuilder +final class IdSortClauseQueryBuilder implements SortClauseQueryBuilder { public function accepts(FilteringSortClause $sortClause): bool {