From 81dbf1cc8ff130d3901d3034ab49f89682896a69 Mon Sep 17 00:00:00 2001 From: fxbt Date: Tue, 2 Nov 2021 19:19:21 +0100 Subject: [PATCH] Add PHP 8 compatibility (#33) * Upgrade atoum/atoum * Upgrade elasticsearch/elasticsearch and add ConnectionInterface return type --- composer.json | 4 ++-- .../ConnectionPool/Selector/RandomStickySelector.php | 2 +- .../ConnectionPool/StaticAliveNoPingConnectionPool.php | 3 ++- .../Units/DependencyInjection/M6WebElasticsearchExtension.php | 2 +- .../ConnectionPool/Selector/RandomStickySelector.php | 2 +- .../ConnectionPool/StaticAliveNoPingConnectionPool.php | 2 +- .../ElasticsearchBundle/Tests/Units/Handler/EventHandler.php | 2 +- .../Tests/Units/Handler/HeadersHandler.php | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 11c3505..d4904bf 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "require": { "php": ">=7.0", "ext-json": "*", - "elasticsearch/elasticsearch": "^5.1.0||^6.0.0" + "elasticsearch/elasticsearch": "^5.1.0||^6.0.0||^7.0" }, "require-dev": { - "atoum/atoum": "^2.8||^3.0", + "atoum/atoum": "^4.0", "m6web/coke": "~1.2.0", "m6web/symfony2-coding-standard": "~1.2.0", "symfony/dependency-injection": "^4.4||^5.0", diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php b/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php index 6e3aa31..47fc9fa 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php @@ -24,7 +24,7 @@ class RandomStickySelector implements SelectorInterface * * @return ConnectionInterface */ - public function select($connections) + public function select($connections): ConnectionInterface { if (empty($connections)) { throw new NoNodesAvailableException('No node to select from…'); diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php b/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php index 2e821af..1091404 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php @@ -5,6 +5,7 @@ use Elasticsearch\Common\Exceptions\NoNodesAvailableException; use Elasticsearch\ConnectionPool\StaticNoPingConnectionPool; use Elasticsearch\Connections\Connection; +use Elasticsearch\Connections\ConnectionInterface; /** * Class StaticAliveNoPingConnectionPool @@ -52,7 +53,7 @@ public function setMaxPingTimeout($maxPingTimeout) * @return Connection * @throws \Elasticsearch\Common\Exceptions\NoNodesAvailableException */ - public function nextConnection($force = false) + public function nextConnection($force = false): ConnectionInterface { // > Replace $this->connections by $connections in order to modify the list later. $connections = $this->connections; diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/DependencyInjection/M6WebElasticsearchExtension.php b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/DependencyInjection/M6WebElasticsearchExtension.php index 619f9a3..bd48236 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/DependencyInjection/M6WebElasticsearchExtension.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/DependencyInjection/M6WebElasticsearchExtension.php @@ -3,7 +3,7 @@ namespace M6Web\Bundle\ElasticsearchBundle\Tests\Units\DependencyInjection; use M6Web\Bundle\ElasticsearchBundle\DependencyInjection\M6WebElasticsearchExtension as TestedClass; -use mageekguy\atoum\test; +use atoum\atoum\test; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php index 9bf43b0..6a1b972 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/Selector/RandomStickySelector.php @@ -5,7 +5,7 @@ use Elasticsearch\Common\Exceptions\NoNodesAvailableException; use Elasticsearch\Connections\Connection; use M6Web\Bundle\ElasticsearchBundle\Tests\Units\Elasticsearch\ConnectionMocker; -use mageekguy\atoum\test; +use atoum\atoum\test; /** * Class RandomStickySelector diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php index 7e66e0a..a3c6ebd 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Elasticsearch/ConnectionPool/StaticAliveNoPingConnectionPool.php @@ -7,7 +7,7 @@ use Elasticsearch\Connections\Connection; use Elasticsearch\Connections\ConnectionFactoryInterface; use M6Web\Bundle\ElasticsearchBundle\Tests\Units\Elasticsearch\ConnectionMocker; -use mageekguy\atoum\test; +use atoum\atoum\test; /** * Class StaticAliveNoPingConnectionPool diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/EventHandler.php b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/EventHandler.php index 3d7da18..3b64146 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/EventHandler.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/EventHandler.php @@ -6,7 +6,7 @@ use GuzzleHttp\Ring\Future\FutureArray; use M6Web\Bundle\ElasticsearchBundle\EventDispatcher\ElasticsearchEvent; use M6Web\Bundle\ElasticsearchBundle\Handler\EventHandler as TestedClass; -use mageekguy\atoum; +use atoum\atoum; use React\Promise\RejectedPromise; /** diff --git a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/HeadersHandler.php b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/HeadersHandler.php index 5f972f4..12c457a 100644 --- a/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/HeadersHandler.php +++ b/src/M6Web/Bundle/ElasticsearchBundle/Tests/Units/Handler/HeadersHandler.php @@ -3,7 +3,7 @@ namespace M6Web\Bundle\ElasticsearchBundle\Tests\Units\Handler; use M6Web\Bundle\ElasticsearchBundle\Handler\HeadersHandler as TestedClass; -use mageekguy\atoum; +use atoum\atoum; /** * HeadersHandler