From 7e59b8fbd2d559e23b294f312db5f53c4892f657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 10 Dec 2024 18:46:17 +0100 Subject: [PATCH 1/2] [v5] Moved from Criterion to CriterionInterface --- .../Criterion/Elasticsearch/CameraManufacturerVisitor.php | 6 +++--- .../src/Query/Criterion/Solr/CameraManufacturerVisitor.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php b/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php index 62e4d4f495..862bd94bf4 100644 --- a/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php +++ b/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php @@ -4,18 +4,18 @@ namespace App\Query\Criterion\Elasticsearch; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Elasticsearch\Query\CriterionVisitor; use Ibexa\Contracts\Elasticsearch\Query\LanguageFilter; final class CameraManufacturerVisitor implements CriterionVisitor { - public function supports(Criterion $criterion, LanguageFilter $languageFilter): bool + public function supports(CriterionInterface $criterion, LanguageFilter $languageFilter): bool { return $criterion instanceof CameraManufacturerCriterion; } - public function visit(CriterionVisitor $dispatcher, Criterion $criterion, LanguageFilter $languageFilter): array + public function visit(CriterionVisitor $dispatcher, CriterionInterface $criterion, LanguageFilter $languageFilter): array { return [ 'terms' => [ diff --git a/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php b/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php index c5ae4bacfd..7d7f4f81be 100644 --- a/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php +++ b/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php @@ -4,17 +4,17 @@ namespace App\Query\Criterion\Solr; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Solr\Query\CriterionVisitor; final class CameraManufacturerVisitor extends CriterionVisitor { - public function canVisit(Criterion $criterion) + public function canVisit(CriterionInterface $criterion) { return $criterion instanceof CameraManufacturerCriterion; } - public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null) + public function visit(CriterionInterface $criterion, CriterionVisitor $subVisitor = null) { $expressions = array_map( function ($value): string { From 03bd73e723a0e4931ff5c3301370db6ff3f16751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 10 Dec 2024 18:49:46 +0100 Subject: [PATCH 2/2] Added PHPdoc --- .../Criterion/Elasticsearch/CameraManufacturerVisitor.php | 3 +++ .../src/Query/Criterion/Solr/CameraManufacturerVisitor.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php b/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php index 862bd94bf4..ea9070b40d 100644 --- a/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php +++ b/code_samples/search/elasticsearch/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php @@ -15,6 +15,9 @@ public function supports(CriterionInterface $criterion, LanguageFilter $language return $criterion instanceof CameraManufacturerCriterion; } + /** + * @param \App\Query\Criterion\Elasticsearch\CameraManufacturerCriterion $criterion + */ public function visit(CriterionVisitor $dispatcher, CriterionInterface $criterion, LanguageFilter $languageFilter): array { return [ diff --git a/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php b/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php index 7d7f4f81be..c45f1a16bf 100644 --- a/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php +++ b/code_samples/search/solr/src/Query/Criterion/Solr/CameraManufacturerVisitor.php @@ -14,6 +14,9 @@ public function canVisit(CriterionInterface $criterion) return $criterion instanceof CameraManufacturerCriterion; } + /** + * @param \App\Query\Criterion\Solr\CameraManufacturerCriterion $criterion + */ public function visit(CriterionInterface $criterion, CriterionVisitor $subVisitor = null) { $expressions = array_map(