Skip to content

Commit c65a977

Browse files
author
Stepan Zolotarev
committed
Update dependencies
1 parent 0078741 commit c65a977

18 files changed

+112
-162
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Install PHP
1414
uses: shivammathur/setup-php@v2
1515
with:
16-
php-version: 8.1
16+
php-version: 8.2
1717
coverage: none
1818
tools: composer:v2
1919

@@ -33,7 +33,7 @@ jobs:
3333
- name: Install PHP
3434
uses: shivammathur/setup-php@v2
3535
with:
36-
php-version: 8.1
36+
php-version: 8.2
3737
coverage: none
3838
tools: composer:v2
3939

@@ -53,7 +53,7 @@ jobs:
5353
- name: Install PHP
5454
uses: shivammathur/setup-php@v2
5555
with:
56-
php-version: 8.1
56+
php-version: 8.2
5757
coverage: none
5858
tools: composer:v2
5959

@@ -91,7 +91,7 @@ jobs:
9191
- name: Install PHP with extensions
9292
uses: shivammathur/setup-php@v2
9393
with:
94-
php-version: 8.1
94+
php-version: 8.2
9595
extensions: ${{ env.PHP_EXTENSIONS }}
9696
ini-values: ${{ env.PHP_INI_VALUES }}
9797
tools: composer:v2

composer.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,31 @@
3030
}
3131
},
3232
"require": {
33-
"php": ">=8.1",
33+
"php": ">=8.2",
3434
"ext-bcmath": "*",
3535
"amphp/amp": "v2.6.*",
36-
"php-service-bus/common": "v5.1.*",
37-
"php-service-bus/storage": "v5.1.*",
38-
"php-service-bus/messages-router": "v5.1.*"
36+
"php-service-bus/common": "v5.2.*",
37+
"php-service-bus/storage": "v5.2.*",
38+
"php-service-bus/messages-router": "v5.2.*"
3939
},
4040
"require-dev": {
41-
"php-service-bus/code-style-config": "v5.1.*",
42-
"symfony/dependency-injection": "v6.0.*",
43-
"monolog/monolog": "v2.4.*",
44-
"phpunit/phpunit": "v9.5.*",
45-
"vimeo/psalm": "v4.22.*",
46-
"phpstan/phpstan": "v1.5.*",
47-
"boesing/psalm-plugin-stringf": "v1.1.*"
41+
"php-service-bus/code-style-config": "v5.2.*",
42+
"symfony/dependency-injection": "^6.3 || ^7.0",
43+
"monolog/monolog": "^2.4 || ^3.0",
44+
"phpunit/phpunit": "^10.0 || ^11.0",
45+
"vimeo/psalm": "^4.30 || ^5.4",
46+
"phpstan/phpstan": "^1.12 || ^2.0"
4847
},
4948
"prefer-stable": true,
5049
"minimum-stability": "stable",
5150
"scripts": {
5251
"psalm": "rm -rf ~/.cache/psalm/ && ./vendor/bin/psalm --config=psalm.xml",
53-
"phpstan": "./vendor/bin/phpstan analyse src --level 9",
54-
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose --debug",
55-
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose --debug",
52+
"phpstan": "./vendor/bin/phpstan analyse src",
53+
"tests": "./vendor/bin/phpunit --configuration phpunit.xml",
54+
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage",
5655
"cs-check": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
5756
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes",
58-
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpstan analyse src --level 9 && ./vendor/bin/phpunit --configuration phpunit.xml --verbose"
57+
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpstan analyse src && ./vendor/bin/phpunit --configuration phpunit.xml"
5958
},
6059
"config": {
6160
"optimize-autoloader": true,

phpstan.neon

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
parameters:
2-
checkMissingIterableValueType: false
3-
checkGenericClassInNonGenericObjectType: false
2+
level: 9
3+
ignoreErrors:
4+
- identifier: varTag.nativeType
5+
- identifier: missingType.generics

phpunit.xml

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,38 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
colors="true"
55
cacheResult="false"
6-
convertDeprecationsToExceptions="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
106
processIsolation="true"
117
stopOnError="false"
128
stopOnFailure="false"
139
beStrictAboutChangesToGlobalState="true"
14-
beStrictAboutOutputDuringTests="true"
15-
verbose="true"
16-
>
17-
<coverage>
18-
<include>
19-
<directory>./src</directory>
20-
</include>
21-
<exclude>
22-
<directory>./tests</directory>
23-
</exclude>
24-
</coverage>
25-
<php>
26-
<ini name="error_reporting" value="-1"/>
27-
<env name="REDIS_CONNECTION_DSN" value="tcp://localhost:6379"/>
28-
<env name="TEST_POSTGRES_DSN" value="pgsql://test:123456789@localhost:5432/test"/>
29-
</php>
30-
<testsuites>
31-
32-
<testsuite name="Component: common">
33-
<directory>./vendor/php-service-bus/common/tests/</directory>
34-
</testsuite>
35-
36-
<testsuite name="Component: messages router">
37-
<directory>./vendor/php-service-bus/messages-router/tests/</directory>
38-
</testsuite>
39-
40-
<testsuite name="Component: storage">
41-
<directory>./vendor/php-service-bus/storage/tests/</directory>
42-
</testsuite>
43-
44-
<testsuite name="Scheduler component">
45-
<directory>./tests/</directory>
46-
</testsuite>
47-
</testsuites>
48-
</phpunit>
10+
beStrictAboutOutputDuringTests="true">
11+
<php>
12+
<ini name="error_reporting" value="-1"/>
13+
<env name="REDIS_CONNECTION_DSN" value="tcp://localhost:6379"/>
14+
<env name="TEST_POSTGRES_DSN" value="pgsql://test:123456789@localhost:5432/test"/>
15+
</php>
16+
<testsuites>
17+
<testsuite name="Component: common">
18+
<directory>./vendor/php-service-bus/common/tests/</directory>
19+
</testsuite>
20+
<testsuite name="Component: messages router">
21+
<directory>./vendor/php-service-bus/messages-router/tests/</directory>
22+
</testsuite>
23+
<testsuite name="Component: storage">
24+
<directory>./vendor/php-service-bus/storage/tests/</directory>
25+
</testsuite>
26+
<testsuite name="Scheduler component">
27+
<directory>./tests/</directory>
28+
</testsuite>
29+
</testsuites>
30+
<source>
31+
<include>
32+
<directory>./src</directory>
33+
</include>
34+
<exclude>
35+
<directory>./tests</directory>
36+
</exclude>
37+
</source>
38+
</phpunit>

psalm.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,4 @@
2121
<PropertyNotSetInConstructor errorLevel="suppress"/>
2222
<UnnecessaryVarAnnotation errorLevel="suppress"/>
2323
</issueHandlers>
24-
<plugins>
25-
<pluginClass class="Boesing\PsalmPluginStringf\Plugin"/>
26-
</plugins>
2724
</psalm>

src/Data/NextScheduledOperation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
namespace ServiceBus\Scheduler\Data;
1414

1515
use ServiceBus\Scheduler\ScheduledOperationId;
16+
1617
use function ServiceBus\Common\datetimeInstantiator;
1718

1819
/**

src/Data/ScheduledOperation.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use ServiceBus\Scheduler\Exceptions\InvalidScheduledOperationExecutionDate;
1616
use ServiceBus\Scheduler\Exceptions\UnserializeCommandFailed;
1717
use ServiceBus\Scheduler\ScheduledOperationId;
18+
1819
use function ServiceBus\Common\datetimeInstantiator;
1920
use function ServiceBus\Common\now;
2021

@@ -83,15 +84,14 @@ public static function restoreFromRow(array $data): self
8384
/** @var \DateTimeImmutable $dateTime */
8485
$dateTime = datetimeInstantiator($data['processing_date']);
8586

87+
/** @var string|false $serializedCommand */
8688
$serializedCommand = \base64_decode($data['command']);
8789

88-
if (\is_string($serializedCommand))
89-
{
90+
if (\is_string($serializedCommand)) {
9091
/** @var false|object $command */
9192
$command = \unserialize($serializedCommand, ['allowed_classes' => true]);
9293

93-
if (\is_object($command))
94-
{
94+
if (\is_object($command)) {
9595
return new self(
9696
ScheduledOperationId::restore($data['id']),
9797
$command,
@@ -121,17 +121,13 @@ private function __construct(
121121
*/
122122
private static function validateDatetime(\DateTimeImmutable $dateTime): void
123123
{
124-
try
125-
{
126-
if (now() >= $dateTime)
127-
{
124+
try {
125+
if (now() >= $dateTime) {
128126
throw new \InvalidArgumentException(
129127
'The date of the scheduled task should be greater than the current one'
130128
);
131129
}
132-
}
133-
catch (\Throwable $throwable)
134-
{
130+
} catch (\Throwable $throwable) {
135131
throw new InvalidScheduledOperationExecutionDate(
136132
$throwable->getMessage(),
137133
(int) $throwable->getCode(),

src/Emitter/RabbitMQEmitter.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use ServiceBus\Scheduler\ScheduledOperationId;
2424
use ServiceBus\Scheduler\Store\Exceptions\ScheduledOperationNotFound;
2525
use ServiceBus\Scheduler\Store\SchedulerStore;
26+
2627
use function Amp\call;
2728
use function ServiceBus\Common\now;
2829

@@ -41,37 +42,32 @@ public function __construct(SchedulerStore $store)
4142
public function emit(ScheduledOperationId $id, ServiceBusContext $context): Promise
4243
{
4344
return call(
44-
function () use ($id, $context): \Generator
45-
{
46-
try
47-
{
45+
function () use ($id, $context): \Generator {
46+
try {
4847
yield $this->store->extract($id, $this->createPostExtract($context));
49-
}
50-
catch (ScheduledOperationNotFound $exception)
51-
{
48+
} catch (ScheduledOperationNotFound $exception) {
5249
$context->logger()->throwable($exception);
5350

5451
yield $context->delivery(
5552
new SchedulerOperationEmitted($id)
5653
);
57-
}
58-
catch (\Throwable $throwable)
59-
{
54+
} catch (\Throwable $throwable) {
6055
throw new EmitFailed($throwable->getMessage(), (int) $throwable->getCode(), $throwable);
6156
}
6257
}
6358
);
6459
}
6560

61+
/**
62+
* @psalm-suppress InvalidReturnType
63+
* @psalm-suppress InvalidReturnStatement
64+
*/
6665
public function emitNextOperation(?NextScheduledOperation $nextOperation, ServiceBusContext $context): Promise
6766
{
6867
return call(
69-
function () use ($nextOperation, $context): \Generator
70-
{
71-
try
72-
{
73-
if ($nextOperation === null)
74-
{
68+
function () use ($nextOperation, $context): \Generator {
69+
try {
70+
if ($nextOperation === null) {
7571
$context->logger()->debug('Next operation not specified');
7672

7773
return;
@@ -92,9 +88,7 @@ function () use ($nextOperation, $context): \Generator
9288
'scheduledOperationDelay' => $delay / 1000,
9389
]
9490
);
95-
}
96-
catch (\Throwable $throwable)
97-
{
91+
} catch (\Throwable $throwable) {
9892
throw new EmitFailed($throwable->getMessage(), (int) $throwable->getCode(), $throwable);
9993
}
10094
}
@@ -106,10 +100,8 @@ function () use ($nextOperation, $context): \Generator
106100
*/
107101
private function createPostExtract(ServiceBusContext $context): callable
108102
{
109-
return static function (?ScheduledOperation $operation, ?NextScheduledOperation $nextOperation) use ($context): \Generator
110-
{
111-
if ($operation !== null)
112-
{
103+
return static function (?ScheduledOperation $operation, ?NextScheduledOperation $nextOperation) use ($context): \Generator {
104+
if ($operation !== null) {
113105
yield $context->delivery($operation->command);
114106
yield $context->delivery(new SchedulerOperationEmitted($operation->id, $nextOperation));
115107

src/Module/SchedulerMessagesRouterConfigurator.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public function __construct(SchedulerEmitter $emitter)
3939
*/
4040
public function configure(Router $router): void
4141
{
42-
try
43-
{
42+
try {
4443
$processor = new SchedulerMessagesProcessor($this->emitter);
4544

4645
$listenEvents = [
@@ -49,15 +48,12 @@ public function configure(Router $router): void
4948
OperationScheduled::class,
5049
];
5150

52-
foreach ($listenEvents as $event)
53-
{
51+
foreach ($listenEvents as $event) {
5452
$router->registerListener($event, $processor);
5553
}
5654

5755
$router->registerHandler(EmitSchedulerOperation::class, $processor);
58-
}
59-
catch (\Throwable $throwable)
60-
{
56+
} catch (\Throwable $throwable) {
6157
throw new MessageRouterConfigurationFailed($throwable->getMessage(), (int) $throwable->getCode(), $throwable);
6258
}
6359
}

src/Module/SchedulerModule.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public function boot(ContainerBuilder $containerBuilder): void
7575
*/
7676
private function getRouterConfiguratorDefinition(ContainerBuilder $containerBuilder): Definition
7777
{
78-
if (false === $containerBuilder->hasDefinition(ChainRouterConfigurator::class))
79-
{
78+
if (false === $containerBuilder->hasDefinition(ChainRouterConfigurator::class)) {
8079
$containerBuilder->addDefinitions(
8180
[
8281
ChainRouterConfigurator::class => new Definition(ChainRouterConfigurator::class),
@@ -86,8 +85,7 @@ private function getRouterConfiguratorDefinition(ContainerBuilder $containerBuil
8685

8786
$routerConfiguratorDefinition = $containerBuilder->getDefinition(ChainRouterConfigurator::class);
8887

89-
if (false === $containerBuilder->hasDefinition(Router::class))
90-
{
88+
if (false === $containerBuilder->hasDefinition(Router::class)) {
9189
$containerBuilder->addDefinitions([Router::class => new Definition(Router::class)]);
9290
}
9391

@@ -109,8 +107,7 @@ private function registerSchedulerMessagesRouterConfigurator(ContainerBuilder $c
109107
*/
110108
private function registerEmitter(ContainerBuilder $containerBuilder): void
111109
{
112-
if (self::TYPE === $this->adapterType)
113-
{
110+
if (self::TYPE === $this->adapterType) {
114111
$containerBuilder->addDefinitions([
115112
SchedulerEmitter::class => (new Definition(RabbitMQEmitter::class))
116113
->setArguments([new Reference(SchedulerStore::class)]),

0 commit comments

Comments
 (0)