Skip to content

Commit

Permalink
Elasticsearch 8
Browse files Browse the repository at this point in the history
  • Loading branch information
limenet committed Jan 15, 2024
1 parent 75b3687 commit 6c41250
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 60 deletions.
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
"version": "3.1.1",
"description": "Elastica bridge for Pimcore",
"type": "pimcore-bundle",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pawelkeska/Elastica"
}
],
"require": {
"php": "^8.1",
"ext-json": "*",
"pimcore/pimcore": "^11.0",
"psr/log": "^3.0",
"ruflin/elastica": "^7.1 || 8.x-dev",
"ruflin/elastica": "dev-feature/up_to_elasticsearch_8",
"symfony/console": "^6.2",
"symfony/lock": "^6.2"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.49",
"phpstan/phpstan": "^1.10.55",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-strict-rules": "^1.5.2",
"rector/rector": "^0.18.12",
"rector/rector": "^0.18.13",
"roave/security-advisories": "dev-latest",
"sentry/sentry": "^3.22.1",
"symfony/http-client": "^6.4.0"
"symfony/http-client": "^6.4.2"
},
"license": "MIT",
"authors": [
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Valantic\ElasticaBridgeBundle\Command;

use Elastica\Exception\ResponseException;
use Elastic\Elasticsearch\Exception\ElasticsearchException;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -62,7 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

try {
$client->delete();
} catch (ResponseException $e) {
} catch (ElasticsearchException $e) {

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.

Check failure on line 65 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Caught class Elastic\Elasticsearch\Exception\ElasticsearchException not found.
$this->output->writeln(sprintf('<error>%s</error>', $e->getMessage()));

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.

Check failure on line 66 in src/Command/Cleanup.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method getMessage() on an unknown class Elastic\Elasticsearch\Exception\ElasticsearchException.
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function ensureCorrectBlueGreenIndexSetup(IndexInterface $indexConfig):
// In case an index with the same name as the blue/green alias exists, delete it
if (
$nonAliasIndex->exists()
&& !$this->esClient->request('_alias/' . $indexConfig->getName(), Request::HEAD)->isOk()
&& !$this->esClient->request(Request::HEAD, '_alias/' . $indexConfig->getName())->asBool()

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 232 in src/Command/Index.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to method asBool() on an unknown class Elastic\Elasticsearch\Response\Elasticsearch.
) {
$nonAliasIndex->delete();
$this->output->writeln('<comment>-> Deleted non-blue/green index to prepare for blue/green usage</comment>');
Expand Down
8 changes: 5 additions & 3 deletions src/Document/DocumentNormalizerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ protected function editables(Document\Page $document): array
$data = [];
$editableNames = array_merge(
array_map(fn (Document\Editable $editable): string => $editable->getName(), $document->getEditables()),
$document->getContentMasterDocument() instanceof Document\PageSnippet
$document->getContentMainDocument() instanceof Document\PageSnippet
? array_map(
fn (Document\Editable $editable): string => $editable->getName(),
$document->getContentMasterDocument()->getEditables()
$document->getContentMainDocument()->getEditables()
)
: []
);
Expand Down Expand Up @@ -84,7 +84,9 @@ protected function editableRelation(
[$contents->getId()],
array_map(
fn (Concrete $obj): int => $obj->getId(),
$contents->getChildren([AbstractObject::OBJECT_TYPE_OBJECT])
$contents
->getChildren([AbstractObject::OBJECT_TYPE_OBJECT])
->getData()??[]
)
);

Expand Down
18 changes: 17 additions & 1 deletion src/Elastica/Client/ElasticsearchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,27 @@

namespace Valantic\ElasticaBridgeBundle\Elastica\Client;

use Elastic\Elasticsearch\Response\Elasticsearch;
use Elastica\Client;

/**
* When typehinted, this class provides an Elastica client pre-configured with port and host.
*
* @see ElasticsearchClientFactory
*/
class ElasticsearchClient extends Client {}
class ElasticsearchClient extends Client
{
/**
* @param array<string,string> $headers
*/
public function request(string $method, string $url, array $headers = [], mixed $body = null): Elasticsearch

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has invalid return type Elastic\Elasticsearch\Response\Elasticsearch.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() has parameter $body with no value type specified in iterable type array.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() overrides method Elastica\Client::request() but misses parameter #5 $contentType.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #2 $url of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is required but parameter #2 $method of method Elastica\Client::request() is optional.

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Parameter #3 $headers (array) of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not contravariant with parameter #3 $data (mixed) of method Elastica\Client::request().

Check failure on line 20 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Return type Elastic\Elasticsearch\Response\Elasticsearch of method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::request() is not covariant with return type Elastica\Response of method Elastica\Client::request().
{
$result = $this->sendRequest($this->createRequest($method, $url, $headers, $body));

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-stable) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.2 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

Check failure on line 22 in src/Elastica/Client/ElasticsearchClient.php

View workflow job for this annotation

GitHub Actions / phpstan (PHP 8.1 with Pimcore ^11.0 (prefer-lowest) on ubuntu-latest)

Call to an undefined method Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient::createRequest().

if (!$result instanceof Elasticsearch) {
throw new \RuntimeException();
}

return $result;
}
}
3 changes: 2 additions & 1 deletion src/Index/AbstractIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Valantic\ElasticaBridgeBundle\Index;

use Elastica\Index;
use Elastica\Request;
use Pimcore\Model\Element\AbstractElement;
use Valantic\ElasticaBridgeBundle\Document\DocumentInterface;
use Valantic\ElasticaBridgeBundle\Elastica\Client\ElasticsearchClient;
Expand Down Expand Up @@ -113,7 +114,7 @@ final public function getBlueGreenActiveSuffix(): IndexBlueGreenSuffix
}

$aliases = array_filter(
$this->client->request('_aliases')->getData(),
json_decode((string) $this->client->request(Request::GET, '_aliases')->getBody(), true, flags: \JSON_THROW_ON_ERROR),
fn (array $datum): bool => array_key_exists($this->getName(), $datum['aliases'])
);

Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/phpcs/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.41.1"
"friendsofphp/php-cs-fixer": "^3.46.0"
}
}
Loading

0 comments on commit 6c41250

Please sign in to comment.