Skip to content

Commit

Permalink
Code review fixes - mostly FQCN
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Dec 10, 2024
1 parent d4e89d8 commit 2c5c1d8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/lib/Event/ContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,8 @@ public function deleteContent(ContentInfo $contentInfo): iterable
? $beforeEvent->getLocations()
: $this->innerService->deleteContent($contentInfo);

if (!is_array($locations)) {
$locations = iterator_to_array($locations);
}

$this->eventDispatcher->dispatch(
new DeleteContentEvent($locations, ...$eventData)
new DeleteContentEvent(iterator_to_array($locations), ...$eventData)
);

return $locations;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Persistence/Cache/TrashHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function trashSubtree($locationId)

$location = $this->persistenceHandler->locationHandler()->load($locationId);
$limit = $this->persistenceHandler->contentHandler()->countRelations(
$location->contentId,
$location->contentId
);

$reverseRelations = $this->persistenceHandler->contentHandler()->loadRelationList(
Expand Down Expand Up @@ -79,7 +79,7 @@ public function recover($trashedId, $newParentId)
$location = $this->persistenceHandler->locationHandler()->load($return);

$limit = $this->persistenceHandler->contentHandler()->countRelations(
$location->contentId,
$location->contentId
);

$reverseRelations = $this->persistenceHandler->contentHandler()->loadRelationList(
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Repository/Helper/RelationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function processFieldRelations(
switch ($relationType) {
case Relation::FIELD:
case Relation::ASSET:
/** @phpstan-var array<int, Relation> $relationEntry */
/** @phpstan-var array<int, \Ibexa\Core\Repository\Values\Content\Relation> $relationEntry */
foreach ($relationEntry as $relation) {
$this->persistenceHandler->contentHandler()->removeRelation(
$relation->id,
Expand All @@ -201,7 +201,7 @@ public function processFieldRelations(
break;
case Relation::LINK:
case Relation::EMBED:
/** @phpstan-var Relation $relationEntry */
/** @phpstan-var \Ibexa\Core\Repository\Values\Content\Relation $relationEntry */
$this->persistenceHandler->contentHandler()->removeRelation(
$relationEntry->id,
$relationType,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Repository/Permission/CachedPermissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CachedPermissionService implements PermissionService
*
* Value is null if not yet set or cleared.
*
* @var null|bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface
* @var bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface|null
*/
private $permissionCriterion;

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/Core/Repository/SearchServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4864,19 +4864,19 @@ protected function simplifySearchResult(SearchResult $result)
case $hit->valueObject instanceof Location:
/** @phpstan-ignore assign.propertyType */
$hit->valueObject = [
/** @phpstan-var Location|Content $hit->valueObject */
/** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\Ibexa\Contracts\Core\Repository\Values\Content\Content $hit->valueObject */
'id' => $hit->valueObject->contentInfo->getId(),
/** @phpstan-var Location|Content $hit->valueObject */
/** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\Ibexa\Contracts\Core\Repository\Values\Content\Content $hit->valueObject */
'title' => $hit->valueObject->contentInfo->getName(),
];
break;

case $hit->valueObject instanceof ContentInfo:
/** @phpstan-ignore assign.propertyType */
$hit->valueObject = [
/** @phpstan-var ContentInfo $hit->valueObject */
/** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $hit->valueObject */
'id' => $hit->valueObject->id,
/** @phpstan-var ContentInfo $hit->valueObject */
/** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $hit->valueObject */
'title' => $hit->valueObject->name,
];
break;
Expand Down

0 comments on commit 2c5c1d8

Please sign in to comment.