Skip to content

Commit 42f8853

Browse files
committed
TASK: Set strict types declaration
1 parent ed8dbc0 commit 42f8853

19 files changed

+56
-12
lines changed

Classes/Domain/Factory/ClientFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Factory;
35

46
/*

Classes/Domain/Factory/DocumentFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Factory;
35

46
/*

Classes/Domain/Model/AbstractType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*

Classes/Domain/Model/Client.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*
@@ -78,8 +80,9 @@ public function setClientConfigurations(array $clientConfigurations)
7880
/**
7981
* @param string $indexName
8082
* @return Index
83+
* @throws \Flowpack\ElasticSearch\Exception
8184
*/
82-
public function findIndex($indexName)
85+
public function findIndex(string $indexName): Index
8386
{
8487
if (!array_key_exists($indexName, $this->indexCollection)) {
8588
$this->indexCollection[$indexName] = new Index($indexName, $this);
@@ -96,8 +99,11 @@ public function findIndex($indexName)
9699
* @param array $arguments
97100
* @param string|array $content
98101
* @return Response
102+
* @throws \Flowpack\ElasticSearch\Transfer\Exception
103+
* @throws \Flowpack\ElasticSearch\Transfer\Exception\ApiException
104+
* @throws \Neos\Flow\Http\Exception
99105
*/
100-
public function request($method, $path = null, array $arguments = [], $content = null)
106+
public function request(string $method, ?string $path = null, array $arguments = [], $content = null): Response
101107
{
102108
return $this->requestService->request($method, $this, $path, $arguments, $content);
103109
}

Classes/Domain/Model/Document.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*

Classes/Domain/Model/GenericType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*

Classes/Domain/Model/Index.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*
@@ -114,7 +116,7 @@ public function __construct($name, Client $client = null)
114116
* @param array $settings
115117
* @return void
116118
*/
117-
public function injectSettings(array $settings)
119+
public function injectSettings(array $settings): void
118120
{
119121
$this->settings = $settings;
120122
}
@@ -123,7 +125,7 @@ public function injectSettings(array $settings)
123125
* @param string $typeName
124126
* @return AbstractType
125127
*/
126-
public function findType($typeName)
128+
public function findType($typeName): AbstractType
127129
{
128130
return new GenericType($this, $typeName);
129131
}
@@ -132,15 +134,16 @@ public function findType($typeName)
132134
* @param array <AbstractType> $types
133135
* @return TypeGroup
134136
*/
135-
public function findTypeGroup(array $types)
137+
public function findTypeGroup(array $types): TypeGroup
136138
{
137139
return new TypeGroup($this, $types);
138140
}
139141

140142
/**
141-
* @return boolean
143+
* @return bool
144+
* @throws \Exception
142145
*/
143-
public function exists()
146+
public function exists(): bool
144147
{
145148
$response = $this->request('HEAD');
146149

@@ -152,14 +155,14 @@ public function exists()
152155
* @param string $path
153156
* @param array $arguments
154157
* @param string $content
155-
* @param boolean $prefixIndex
158+
* @param bool $prefixIndex
156159
* @return Response
157-
* @throws ElasticSearchException
160+
* @throws \Exception
158161
*/
159-
public function request($method, $path = null, array $arguments = [], $content = null, $prefixIndex = true)
162+
public function request(string $method, ?string $path = null, array $arguments = [], ?string $content = null, bool $prefixIndex = true): Response
160163
{
161164
if ($this->client === null) {
162-
throw new Exception('The client of the index "' . $this->name . '" is not set, hence no requests can be done.');
165+
throw new \Exception('The client of the index "' . $this->name . '" is not set, hence no requests can be done.', 1566313883);
163166
}
164167
$path = ($path ? trim($path) : '');
165168
if ($prefixIndex === true) {
@@ -173,8 +176,9 @@ public function request($method, $path = null, array $arguments = [], $content =
173176

174177
/**
175178
* @return void
179+
* @throws \Exception
176180
*/
177-
public function create()
181+
public function create(): void
178182
{
179183
$this->request('PUT', null, [], json_encode($this->getSettings()));
180184
}
@@ -196,6 +200,7 @@ protected function getSettings()
196200

197201
/**
198202
* @return void
203+
* @throws \Exception
199204
*/
200205
public function updateSettings()
201206
{

Classes/Domain/Model/Mapping.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*

Classes/Domain/Model/TypeGroup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Domain\Model;
35

46
/*

Classes/Indexer/Aspect/IndexerAspect.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
namespace Flowpack\ElasticSearch\Indexer\Aspect;
35

46
/*

0 commit comments

Comments
 (0)