Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic committed Apr 4, 2024
1 parent 1a0d23e commit 01555b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/lib/Query/Content/CriterionVisitor/IsContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public function canVisit(Criterion $criterion): bool

public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null): string
{
return 'content_type_is_container_b:' . ($criterion->value[0] ? 'true' : 'false');
$value = $criterion->value;

if (!is_array($value) || !is_bool($value[0])) {
throw new \LogicException('Criterion value should be of type array<bool>');
}

return 'content_type_is_container_b:' . ($value[0] ? 'true' : 'false');
}
}
10 changes: 8 additions & 2 deletions src/lib/Query/Location/CriterionVisitor/IsContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator;
use Ibexa\Contracts\Solr\Query\CriterionVisitor;

class IsContainer extends CriterionVisitor
final class IsContainer extends CriterionVisitor
{
public function canVisit(Criterion $criterion): bool
{
Expand All @@ -19,6 +19,12 @@ public function canVisit(Criterion $criterion): bool

public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null): string
{
return 'is_container_b:' . ($criterion->value[0] ? 'true' : 'false');
$value = $criterion->value;

if (!is_array($value) || !is_bool($value[0])) {
throw new \LogicException('Criterion value should be of type array<bool>');
}

return 'is_container_b:' . ($value[0] ? 'true' : 'false');
}
}

0 comments on commit 01555b4

Please sign in to comment.