diff --git a/CHANGELOG.md b/CHANGELOG.md index 20b20547c..2c7247179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed `$origin` and `$scale` parameter types of `Elastica\Query\FunctionScore::addDecayFunction()` to allow `float|int|string` [#2144](https://github.com/ruflin/Elastica/pull/2144) * Changed `$key` parameter type of `Elastica\Multi\Search::addSearch()` to allow `int|string|null` [#2144](https://github.com/ruflin/Elastica/pull/2144) * Changed `$options` parameter type of `Elastica\Index::create()` to only allow `array` [#2147](https://github.com/ruflin/Elastica/pull/2147) +* Changed `Elastica\Reindex::setWaitForCompletion()` to only allow `bool` [#2151](https://github.com/ruflin/Elastica/pull/2151) * Changed `Elastica\Search::addIndex()`, `Elasica\Search::addIndices()` and `Elastica\Search::hasIndex()` parameter type to only allow `Elastica\Index` [#2150](https://github.com/ruflin/Elastica/pull/2150) * Changed `$options` argument to not accept `int` in the following methods [#2148](https://github.com/ruflin/Elastica/pull/2148) * `Elastica\SearchableInterface::search()` diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 58317c4a6..f2d6eb229 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -170,11 +170,6 @@ parameters: count: 1 path: tests/QueryBuilderTest.php - - - message: "#^Parameter \\#1 \\$value of method Elastica\\\\Reindex\\:\\:setWaitForCompletion\\(\\) expects bool, string given\\.$#" - count: 1 - path: tests/ReindexTest.php - - message: "#^Expression \"\\$index\\-\\>search\\('elastica search'\\)\\[3\\]\" on a separate line does not do anything\\.$#" count: 1 diff --git a/src/Reindex.php b/src/Reindex.php index 751c1a98f..05cc2698c 100644 --- a/src/Reindex.php +++ b/src/Reindex.php @@ -77,18 +77,9 @@ public function run(): Response return $this->_lastResponse; } - /** - * @param bool $value - */ - public function setWaitForCompletion($value): void + public function setWaitForCompletion(bool $value): void { - if (\is_bool($value)) { - $value = $value ? 'true' : 'false'; - } else { - \trigger_deprecation('ruflin/elastica', '7.2.0', 'Passing anything else than a boolean as 1st argument to "%s()" is deprecated, pass a boolean instead. It will be removed in 8.0.', __METHOD__); - } - - $this->setParam(self::WAIT_FOR_COMPLETION, $value); + $this->setParam(self::WAIT_FOR_COMPLETION, $value ? 'true' : 'false'); } public function setWaitForActiveShards($value): void diff --git a/tests/ReindexTest.php b/tests/ReindexTest.php index 502c4ab6b..88a539a82 100644 --- a/tests/ReindexTest.php +++ b/tests/ReindexTest.php @@ -149,24 +149,6 @@ public function testReindexWithFalseSetOnWaitForCompletion(): void $this->assertNotEmpty($reindex->getTaskId()); } - /** - * @group functional - * @group legacy - */ - public function testReindexWithDeprecatedConstantSetOnWaitForCompletion(): void - { - $oldIndex = $this->_createIndex('idx1', true, 2); - $this->_addDocs($oldIndex, 10); - - $newIndex = $this->_createIndex('idx2', true, 2); - - $reindex = new Reindex($oldIndex, $newIndex); - $reindex->setWaitForCompletion(Reindex::WAIT_FOR_COMPLETION_FALSE); - $reindex->run(); - - $this->assertNotEmpty($reindex->getTaskId()); - } - /** * @group functional */