From 8faadc52debd277213961be86f2eef7c35d484ee Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Wed, 1 Jun 2022 08:30:02 +0200 Subject: [PATCH] Deprecate Reindex::WAIT_FOR_COMPLETION_FALSE --- CHANGELOG.md | 2 ++ src/Reindex.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca5e5369c..bbf9c01d2a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Updated `symfony/phpunit-bridge` to `6.0` by @franmomu [#2067](https://github.com/ruflin/Elastica/pull/2067) ### Deprecated +* Deprecated `Elastica\Reindex::WAIT_FOR_COMPLETION_FALSE`, use a boolean as parameter instead by @franmomu [#2070](https://github.com/ruflin/Elastica/pull/2070) +* Passing anything else than a boolean as 1st argument to `Reindex::setWaitForCompletion`, pass a boolean instead by @franmomu [#2070](https://github.com/ruflin/Elastica/pull/2070) ### Removed * Removed `egeloen/http-adapter` as suggested package since the project is abandoned by @franmomu [#2069](https://github.com/ruflin/Elastica/pull/2069) * Removed `0` as valid request data using Analyze API by @franmomu [#2068](https://github.com/ruflin/Elastica/pull/2068) diff --git a/src/Reindex.php b/src/Reindex.php index 3db0c31c01..5bfc4c6aab 100644 --- a/src/Reindex.php +++ b/src/Reindex.php @@ -27,6 +27,10 @@ class Reindex extends Param public const REFRESH_FALSE = 'false'; public const REFRESH_WAIT_FOR = 'wait_for'; public const WAIT_FOR_COMPLETION = 'wait_for_completion'; + + /** + * @deprecated since version 7.2.0, use a boolean as parameter instead. + */ public const WAIT_FOR_COMPLETION_FALSE = 'false'; public const WAIT_FOR_ACTIVE_SHARDS = 'wait_for_active_shards'; public const TIMEOUT = 'timeout'; @@ -80,6 +84,8 @@ public function setWaitForCompletion($value): void { if (\is_bool($value)) { $value = $value ? 'true' : 'false'; + } else { + \trigger_deprecation('ruflin/elastica', '7.1.6', '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);