From 47c6af061dedec1aaed6487063383a0b9f0a0da8 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Fri, 8 Nov 2024 07:54:49 +0000 Subject: [PATCH 1/3] make index a defined property, and type hint properties --- src/Search/Api/Elasticsearch/PlainElasticsearchClient.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Search/Api/Elasticsearch/PlainElasticsearchClient.php b/src/Search/Api/Elasticsearch/PlainElasticsearchClient.php index 4c487e37..bd2d90ef 100644 --- a/src/Search/Api/Elasticsearch/PlainElasticsearchClient.php +++ b/src/Search/Api/Elasticsearch/PlainElasticsearchClient.php @@ -6,7 +6,9 @@ class PlainElasticsearchClient { - private $libraryClient; + private Client $libraryClient; + + private string $index; public function __construct(Client $libraryClient, string $index) { From 4379ad68a9203b5ae7d0bcfafc84b89eababeb60 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Fri, 8 Nov 2024 07:55:44 +0000 Subject: [PATCH 2/3] make sample a defined property --- tests/src/Search/IndexMetadataTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/Search/IndexMetadataTest.php b/tests/src/Search/IndexMetadataTest.php index 0eed699a..0ed190c1 100644 --- a/tests/src/Search/IndexMetadataTest.php +++ b/tests/src/Search/IndexMetadataTest.php @@ -7,6 +7,8 @@ class IndexMetadataTest extends TestCase { + private IndexMetadata $sample; + public function setUp(): void { $this->sample = IndexMetadata::fromContents('search_2', 'search_1'); From 4bcac50ca4febcd4c5c19014afa448f94d9611cf Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Fri, 8 Nov 2024 07:56:27 +0000 Subject: [PATCH 3/3] remove $client, and define $mappedClient and $plainClient with correct type hints --- tests/src/Search/Web/ElasticTestCase.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/src/Search/Web/ElasticTestCase.php b/tests/src/Search/Web/ElasticTestCase.php index 5a274652..c4fd8d31 100644 --- a/tests/src/Search/Web/ElasticTestCase.php +++ b/tests/src/Search/Web/ElasticTestCase.php @@ -9,8 +9,6 @@ use eLife\Search\Kernel; use eLife\Search\KeyValueStore\ElasticSearchKeyValueStore; use Psr\Log\NullLogger; -use RuntimeException; -use Symfony\Component\BrowserKit\Client; use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\StreamOutput; @@ -20,8 +18,10 @@ abstract class ElasticTestCase extends WebTestCase { protected $console; - /** @var MappedElasticsearchClient */ - protected $client; + + protected MappedElasticsearchClient $mappedClient; + + protected PlainElasticsearchClient $plainClient; public function getCollectionFixture(int $num) {