Skip to content

Commit 6ce5dd6

Browse files
authored
Merge pull request #1803 from deguif/resetter-signature
Add type-hints to ResetterInterface
2 parents 2a8973d + 7663b5c commit 6ce5dd6

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

CHANGELOG-6.0.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ in 6.0 versions.
66

77
### 6.0.0-RC1 (2021-xx-xx)
88

9-
* **[BC break]** Signature of `FOS\ElasticaBundle\Configuration\Source\SourceInterface::getConfiguration()` has changed.
9+
* **[BC break]** Changed signature of `FOS\ElasticaBundle\Configuration\Source\SourceInterface::getConfiguration()`.
10+
* **[BC break]** Changed signature of methods `resetAllIndexes` and `resetIndex` from interface `FOS\ElasticaBundle\Index\ResetterInterface` and its implementations.
1011

1112
### 6.0.0-BETA4 (2021-05-24)
1213

@@ -20,9 +21,9 @@ in 6.0 versions.
2021
* **[BC break]** Marked the `fos_elastica.client_prototype` service as private.
2122
* **[BC break]** Marked the `fos_elastica.index_template_prototype` service as private.
2223
* **[BC break]** Marked all events final and introduced several abstract classes.
23-
* **[BC break]** Signature of `FantaPaginatorAdapter::getNbResults()` has changed.
24-
* **[BC break]** Signature of `FantaPaginatorAdapter::getSlice()` has changed.
25-
* **[BC break]** Signature of `PartialResultsInterface::toArray()`, `PartialResultsInterface::getTotalHits()` and `PartialResultsInterface::getAggregations()` have changed.
24+
* **[BC break]** Changed signature of `FantaPaginatorAdapter::getNbResults()`.
25+
* **[BC break]** Changed signature of `FantaPaginatorAdapter::getSlice()`.
26+
* **[BC break]** Changed signature of `PartialResultsInterface::toArray()`, `PartialResultsInterface::getTotalHits()` and `PartialResultsInterface::getAggregations()`.
2627

2728
### 6.0.0-BETA3 (2020-09-28)
2829

src/Index/Resetter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __construct(
6363
/**
6464
* Deletes and recreates all indexes.
6565
*/
66-
public function resetAllIndexes(bool $populating = false, bool $force = false)
66+
public function resetAllIndexes(bool $populating = false, bool $force = false): void
6767
{
6868
foreach ($this->configManager->getIndexNames() as $name) {
6969
$this->resetIndex($name, $populating, $force);
@@ -76,7 +76,7 @@ public function resetAllIndexes(bool $populating = false, bool $force = false)
7676
*
7777
* @throws \InvalidArgumentException if no index exists for the given name
7878
*/
79-
public function resetIndex(string $indexName, bool $populating = false, bool $force = false)
79+
public function resetIndex(string $indexName, bool $populating = false, bool $force = false): void
8080
{
8181
$indexConfig = $this->configManager->getIndexConfiguration($indexName);
8282
$index = $this->indexManager->getIndex($indexName);
@@ -102,7 +102,7 @@ public function resetIndex(string $indexName, bool $populating = false, bool $fo
102102
*
103103
* @throws \FOS\ElasticaBundle\Exception\AliasIsIndexException
104104
*/
105-
public function switchIndexAlias(string $indexName, bool $delete = true)
105+
public function switchIndexAlias(string $indexName, bool $delete = true): void
106106
{
107107
$indexConfig = $this->configManager->getIndexConfiguration($indexName);
108108

src/Index/ResetterInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@ interface ResetterInterface
2020
{
2121
/**
2222
* Reset all indexes.
23-
*
24-
* @return void
2523
*/
26-
public function resetAllIndexes();
24+
public function resetAllIndexes(): void;
2725

2826
/**
2927
* Reset index.
30-
*
31-
* @return void
3228
*/
33-
public function resetIndex(string $indexName);
29+
public function resetIndex(string $indexName): void;
3430
}

src/Index/TemplateResetter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class TemplateResetter implements ResetterInterface
3939
private $client;
4040

4141
/**
42-
* Index template manager.
43-
*
4442
* @var IndexTemplateManager
4543
*/
4644
private $indexTemplateManager;
@@ -57,14 +55,14 @@ public function __construct(
5755
$this->indexTemplateManager = $indexTemplateManager;
5856
}
5957

60-
public function resetAllIndexes($deleteIndexes = false)
58+
public function resetAllIndexes(bool $deleteIndexes = false): void
6159
{
6260
foreach ($this->configManager->getIndexNames() as $name) {
6361
$this->resetIndex($name, $deleteIndexes);
6462
}
6563
}
6664

67-
public function resetIndex(string $indexName, bool $deleteIndexes = false)
65+
public function resetIndex(string $indexName, bool $deleteIndexes = false): void
6866
{
6967
$indexTemplateConfig = $this->configManager->getIndexConfiguration($indexName);
7068
if (!$indexTemplateConfig instanceof IndexTemplateConfig) {
@@ -82,7 +80,7 @@ public function resetIndex(string $indexName, bool $deleteIndexes = false)
8280
/**
8381
* Delete all template indexes.
8482
*/
85-
public function deleteTemplateIndexes(IndexTemplateConfig $template)
83+
public function deleteTemplateIndexes(IndexTemplateConfig $template): void
8684
{
8785
$this->client->request($template->getTemplate().'/', Request::DELETE);
8886
}

0 commit comments

Comments
 (0)