Skip to content

Commit

Permalink
Added check if criterion value is type of array
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Aug 23, 2024
1 parent 002178a commit 4c7bbaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1135,11 +1135,6 @@ parameters:
count: 1
path: src/lib/Query/Location/CriterionVisitor/Location/DepthIn.php

-
message: "#^Cannot access offset 0 on array\\<bool\\|float\\|int\\|string\\>\\|bool\\|float\\|int\\|string\\.$#"
count: 1
path: src/lib/Query/Location/CriterionVisitor/Location/IsBookmarked.php

-
message: "#^Cannot access offset 0 on array\\<bool\\|float\\|int\\|string\\>\\|bool\\|float\\|int\\|string\\.$#"
count: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Ibexa\Contracts\Core\Repository\PermissionResolver;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Solr\Query\CriterionVisitor;
use LogicException;

final class IsBookmarked extends CriterionVisitor
{
Expand All @@ -33,6 +34,10 @@ public function visit(
Criterion $criterion,
CriterionVisitor $subVisitor = null
): string {
if (!is_array($criterion->value)) {
throw new LogicException('Expected IsBookmarked Criterion value to be an array');
}

$userId = $this->permissionResolver
->getCurrentUserReference()
->getUserId();
Expand Down

0 comments on commit 4c7bbaf

Please sign in to comment.