Skip to content

Commit 4686948

Browse files
authored
v4.0.0
__BREAKING CHANGES__ * Require php 8.1 and allow symfony 5.x|6.x. * Require gdbots/schemas and gdbots/query-parser 3.x
1 parent fe1837f commit 4686948

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+177
-156
lines changed

CHANGELOG-4.x.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CHANGELOG for 4.x
2+
This changelog references the relevant changes done in 4.x versions.
3+
4+
5+
## v4.0.0
6+
__BREAKING CHANGES__
7+
8+
* Require php 8.1 and allow symfony 5.x|6.x.
9+
* Require gdbots/schemas and gdbots/query-parser 3.x

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
"type": "library",
55
"license": "Apache-2.0",
66
"require": {
7-
"php": ">=7.4",
7+
"php": ">=8.1",
88
"ext-json": "*",
9-
"gdbots/query-parser": "^2.0",
10-
"gdbots/schemas": "^2.0",
11-
"psr/log": "^1",
12-
"symfony/event-dispatcher": "^5.1"
9+
"gdbots/query-parser": "^3.0",
10+
"gdbots/schemas": "^3.0",
11+
"psr/log": "^1|^2|^3",
12+
"symfony/event-dispatcher": "^5.4|^6.0"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "^9.2",
15+
"phpunit/phpunit": "^9.5",
1616
"aws/aws-sdk-php": "^3.138",
17-
"gdbots/acme-schemas": "^2.0",
18-
"ruflin/elastica": "^7.0"
17+
"gdbots/acme-schemas": "^3.0",
18+
"ruflin/elastica": "^7.1"
1919
},
2020
"autoload": {
2121
"psr-4": {

src/AbstractServiceLocator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ final public function getEventStore(): EventStore
122122

123123
protected function doGetEventStore(): EventStore
124124
{
125-
throw new LogicException('No EventStore has been configured.', Code::UNIMPLEMENTED);
125+
throw new LogicException('No EventStore has been configured.', Code::UNIMPLEMENTED->value);
126126
}
127127

128128
final public function getEventSearch(): EventSearch
@@ -136,7 +136,7 @@ final public function getEventSearch(): EventSearch
136136

137137
protected function doGetEventSearch(): EventSearch
138138
{
139-
throw new LogicException('No EventSearch has been configured.', Code::UNIMPLEMENTED);
139+
throw new LogicException('No EventSearch has been configured.', Code::UNIMPLEMENTED->value);
140140
}
141141

142142
final public function getScheduler(): Scheduler
@@ -150,7 +150,7 @@ final public function getScheduler(): Scheduler
150150

151151
protected function doGetScheduler(): Scheduler
152152
{
153-
throw new LogicException('No Scheduler has been configured.', Code::UNIMPLEMENTED);
153+
throw new LogicException('No Scheduler has been configured.', Code::UNIMPLEMENTED->value);
154154
}
155155

156156
final protected function getDefaultTransport(): Transport

src/Consumer/AbstractConsumer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private function handleRequest(Message $request): Message
178178
return $this->locator->getRequestBus()->receiveRequest($request);
179179
}
180180

181-
final public function handleSignals(int $signo, $signinfo = null): void
181+
final public function handleSignals(int $signo, mixed $signinfo = null): void
182182
{
183183
switch ($signo) {
184184
case SIGINT:

src/Event/EnrichContextEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function has(string $name): bool
6969
return isset($this->context[$name]);
7070
}
7171

72-
public function get(string $name, $default = null)
72+
public function get(string $name, mixed $default = null): mixed
7373
{
7474
return $this->context[$name] ?? $default;
7575
}

src/EventSearch/Elastica/AwsAuthV4.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
use Aws\Signature\SignatureV4;
99
use Elastica\Connection;
1010
use Elastica\Transport\Guzzle;
11-
use GuzzleHttp;
1211
use GuzzleHttp\Client;
1312
use GuzzleHttp\HandlerStack;
1413
use GuzzleHttp\Middleware;
1514
use GuzzleHttp\RequestOptions;
15+
use GuzzleHttp\Utils;
1616
use Psr\Http\Message\RequestInterface;
1717

1818
/**
@@ -32,7 +32,7 @@ class AwsAuthV4 extends Guzzle
3232
protected function _getGuzzleClient(bool $persistent = true): Client
3333
{
3434
if (!$persistent || !self::$_guzzleClientConnection) {
35-
$stack = HandlerStack::create(GuzzleHttp\choose_handler());
35+
$stack = HandlerStack::create(Utils::chooseHandler());
3636
$stack->push($this->getConnectTimeoutMiddleware(), 'connect_timeout');
3737
$stack->push($this->getSigningMiddleware(), 'sign');
3838

src/EventSearch/Elastica/ElasticaEventSearch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ final public function createStorage(array $context = []): void
9090
ClassUtil::getShortName($e),
9191
$indexName
9292
),
93-
Code::INTERNAL,
93+
Code::INTERNAL->value,
9494
$e
9595
);
9696
}
@@ -207,7 +207,7 @@ final public function indexEvents(array $events, array $context = []): void
207207
ClassUtil::getShortName($e),
208208
$e->getMessage()
209209
),
210-
Code::INTERNAL,
210+
Code::INTERNAL->value,
211211
$e
212212
);
213213
}
@@ -265,7 +265,7 @@ final public function deleteEvents(array $eventIds, array $context = []): void
265265
ClassUtil::getShortName($e),
266266
$e->getMessage()
267267
),
268-
Code::INTERNAL,
268+
Code::INTERNAL->value,
269269
$e
270270
);
271271
}
@@ -310,7 +310,7 @@ final public function searchEvents(Message $request, ParsedQuery $parsedQuery, M
310310
$request->get('q'),
311311
ClassUtil::getShortName($e) . '::' . $e->getMessage()
312312
),
313-
Code::INTERNAL,
313+
Code::INTERNAL->value,
314314
$e
315315
);
316316
}

src/EventSearch/Elastica/IndexManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ final public function updateIndex(Client $client, string $name): void
219219
'allow_no_indices' => true,
220220
]);
221221
} catch (\Throwable $e) {
222-
if (false !== strpos($e->getMessage(), 'no such index')) {
222+
if (str_contains($e->getMessage(), 'no such index')) {
223223
$this->logger->info(sprintf('No index exists yet [%s] in ElasticSearch. Ignoring.', $name));
224224
return;
225225
}
226226

227227
throw new EventSearchOperationFailed(
228228
sprintf('Failed to put mapping for index [%s] into ElasticSearch.', $name),
229-
Code::INTERNAL,
229+
Code::INTERNAL->value,
230230
$e
231231
);
232232
}

src/EventSearch/Elastica/QueryFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ final public function create(Message $request, ParsedQuery $parsedQuery, array $
4444

4545
protected function applyDateFilters(Message $request, ParsedQuery $parsedQuery): void
4646
{
47-
$required = BoolOperator::REQUIRED();
47+
$required = BoolOperator::REQUIRED;
4848

4949
$dateFilters = [
5050
[
5151
'query' => 'occurred_after',
5252
'field' => 'occurred_at',
53-
'operator' => ComparisonOperator::GT(),
53+
'operator' => ComparisonOperator::GT,
5454
],
5555
[
5656
'query' => 'occurred_before',
5757
'field' => 'occurred_at',
58-
'operator' => ComparisonOperator::LT(),
58+
'operator' => ComparisonOperator::LT,
5959
],
6060
];
6161

@@ -105,7 +105,7 @@ protected function filterCuries(Message $request, Query\BoolQuery $query, array
105105
*/
106106
protected function createSortedQuery(AbstractQuery $query, Message $request): Query
107107
{
108-
switch ($request->get('sort')->getValue()) {
108+
switch ($request->get('sort')) {
109109
case SearchEventsSort::DATE_DESC:
110110
$query = Query::create($query);
111111
$query->setSort(['occurred_at' => 'desc']);

src/EventSearch/EventIndexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
final class EventIndexer implements EventSubscriber
1111
{
12-
public static function getSubscribedEvents()
12+
public static function getSubscribedEvents(): array
1313
{
1414
return [
1515
'gdbots:pbjx:mixin:indexed' => 'onIndexed',

0 commit comments

Comments
 (0)