Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Jan 22, 2025
1 parent 80c9577 commit 594a395
Show file tree
Hide file tree
Showing 26 changed files with 117 additions and 112 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"require": {
"php": ">=8.1",
"ext-json": "*",
"spiral/core": "^3.15",
"spiral/hmvc": "^3.15",
"spiral/serializer": "^3.15",
"spiral/snapshots": "^3.15",
"spiral/telemetry": "^3.15",
"spiral/tokenizer": "^3.15",
"spiral/core": "^3.14.10",
"spiral/hmvc": "^3.14.10",
"spiral/serializer": "^3.14.10",
"spiral/snapshots": "^3.14.10",
"spiral/telemetry": "^3.14.10",
"spiral/tokenizer": "^3.14.10",
"spiral/attributes": "^2.8|^3.0",
"doctrine/inflector": "^1.4|^2.0",
"ramsey/uuid": "^4.2.3",
Expand All @@ -59,7 +59,7 @@
"require-dev": {
"phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/boot": "^3.15",
"spiral/boot": "^3.14.10",
"vimeo/psalm": "^5.9"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/RetryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class RetryPolicy
{
/**
* @param int<0, max> $maxAttempts
* @param 0|positive-int $maxAttempts
* @param positive-int $delay in seconds.
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/ContainerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getHandler(string $jobType): HandlerInterface
private function className(string $jobType): string
{
$names = \explode('.', $jobType);
$names = \array_map(fn (string $value): string => $this->inflector->classify($value), $names);
$names = \array_map(fn (string $value) => $this->inflector->classify($value), $names);

return \implode('\\', $names);
}
Expand Down
8 changes: 4 additions & 4 deletions src/RetryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
final class RetryPolicy implements RetryPolicyInterface
{
/**
* @var int<0, max>
* @var positive-int|0
*/
private readonly int $maxAttempts;

/**
* @var int<0, max>
* @var positive-int|0
*/
private readonly int $delay;

Expand Down Expand Up @@ -50,7 +50,7 @@ public function __construct(int $maxAttempts, int $delay, float $multiplier = 1)
}

/**
* @param int<0, max> $attempts
* @param positive-int|0 $attempts
*
* @return positive-int
*/
Expand All @@ -60,7 +60,7 @@ public function getDelay(int $attempts = 0): int
}

/**
* @param int<0, max> $attempts
* @param positive-int|0 $attempts
*/
public function isRetryable(\Throwable $exception, int $attempts = 0): bool
{
Expand Down
4 changes: 2 additions & 2 deletions src/RetryPolicyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
interface RetryPolicyInterface
{
/**
* @param int<0, max> $attempts
* @param positive-int|0 $attempts
*/
public function isRetryable(\Throwable $exception, int $attempts = 0): bool;

/**
* @param int<0, max> $attempts
* @param positive-int|0 $attempts
*
* @return positive-int
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Attribute/JobHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testJobHandler(string $class, ?JobHandler $expected): void
{
$reader = (new Factory())->create();

self::assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), JobHandler::class));
$this->assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), JobHandler::class));
}

public static function classesProvider(): \Traversable
Expand Down
2 changes: 1 addition & 1 deletion tests/Attribute/RetryPolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testRetryPolicy(string $class, ?RetryPolicy $expected): void
{
$reader = (new Factory())->create();

self::assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), RetryPolicy::class));
$this->assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), RetryPolicy::class));
}

public static function classesProvider(): \Traversable
Expand Down
2 changes: 1 addition & 1 deletion tests/Attribute/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testSerializer(string $class, ?Serializer $expected): void
{
$reader = (new Factory())->create();

self::assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), Serializer::class));
$this->assertEquals($expected, $reader->firstClassMetadata(new \ReflectionClass($class), Serializer::class));
}

public static function classesProvider(): \Traversable
Expand Down
34 changes: 17 additions & 17 deletions tests/Config/QueueConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testGetsAliases(): void
'aliases' => ['foo', 'bar'],
]);

self::assertSame(['foo', 'bar'], $config->getAliases());
$this->assertSame(['foo', 'bar'], $config->getAliases());
}

public function testConsumeInterceptors(): void
Expand All @@ -30,7 +30,7 @@ public function testConsumeInterceptors(): void
],
]);

self::assertSame(['foo', 'bar'], $config->getConsumeInterceptors());
$this->assertSame(['foo', 'bar'], $config->getConsumeInterceptors());
}

public function testPushInterceptors(): void
Expand All @@ -41,22 +41,22 @@ public function testPushInterceptors(): void
],
]);

self::assertSame(['foo', 'bar'], $config->getPushInterceptors());
$this->assertSame(['foo', 'bar'], $config->getPushInterceptors());
}

public function testGetNotExistsAliases(): void
{
$config = new QueueConfig();

self::assertSame([], $config->getAliases());
$this->assertSame([], $config->getAliases());
}

public function testGetsDefaultDriver(): void
{
$config = new QueueConfig([
'default' => 'foo',
]);
self::assertSame('foo', $config->getDefaultDriver());
$this->assertSame('foo', $config->getDefaultDriver());
}

public function testGetsNonStringDefaultDriverShouldThrowAnException(): void
Expand All @@ -75,14 +75,14 @@ public function testGetsDriverAliases(): void
'driverAliases' => ['foo', 'bar'],
]);

self::assertSame(['foo', 'bar'], $config->getDriverAliases());
$this->assertSame(['foo', 'bar'], $config->getDriverAliases());
}

public function testGetNotExistsDriverAliases(): void
{
$config = new QueueConfig();

self::assertSame([], $config->getDriverAliases());
$this->assertSame([], $config->getDriverAliases());
}

public function testGetsConnectionsWithoutDriver(): void
Expand All @@ -91,14 +91,14 @@ public function testGetsConnectionsWithoutDriver(): void
'connections' => ['foo', 'bar'],
]);

self::assertSame(['foo', 'bar'], $config->getConnections());
$this->assertSame(['foo', 'bar'], $config->getConnections());
}

public function testGetsNotExistsConnections(): void
{
$config = new QueueConfig();

self::assertSame([], $config->getConnections());
$this->assertSame([], $config->getConnections());
}

public function testGetsConnectionsWithSpecificDriverAlias(): void
Expand All @@ -118,7 +118,7 @@ public function testGetsConnectionsWithSpecificDriverAlias(): void
],
]);

self::assertSame([
$this->assertSame([
'foo' => [
'driver' => 'baz',
],
Expand All @@ -142,7 +142,7 @@ public function testGetsConnectionsWithSpecificDriver(): void
],
]);

self::assertSame([
$this->assertSame([
'foo' => [
'driver' => 'alias',
],
Expand All @@ -169,7 +169,7 @@ public function testGetsConnection(): void
],
]);

self::assertSame([
$this->assertSame([
'driver' => 'baz',
], $config->getConnection('foo'));
}
Expand Down Expand Up @@ -240,14 +240,14 @@ public function testGetsRegistryHandlers(): void
]
]);

self::assertSame(['foo', 'bar'], $config->getRegistryHandlers());
$this->assertSame(['foo', 'bar'], $config->getRegistryHandlers());
}

public function testGetsNotExistsRegistryHandlers(): void
{
$config = new QueueConfig();

self::assertSame([], $config->getRegistryHandlers());
$this->assertSame([], $config->getRegistryHandlers());
}

public function testGetRegistrySerializers(): void
Expand All @@ -258,22 +258,22 @@ public function testGetRegistrySerializers(): void
]
]);

self::assertSame(['foo' => 'some', 'bar' => 'other'], $config->getRegistrySerializers());
$this->assertSame(['foo' => 'some', 'bar' => 'other'], $config->getRegistrySerializers());
}

public function testGetNotExistsRegistrySerializers(): void
{
$config = new QueueConfig();

self::assertSame([], $config->getRegistrySerializers());
$this->assertSame([], $config->getRegistrySerializers());
}

#[DataProvider('defaultSerializerDataProvider')]
public function testGetDefaultSerializer(array $config, mixed $expected): void
{
$config = new QueueConfig($config);

self::assertEquals($expected, $config->getDefaultSerializer());
$this->assertEquals($expected, $config->getDefaultSerializer());
}

public static function defaultSerializerDataProvider(): \Generator
Expand Down
2 changes: 1 addition & 1 deletion tests/ContainerRegistryT.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testGetsHandlerByJobType(): void

$this->registry->getHandler('mail.job');

self::assertSame($handler, $this->registry->getHandler('mail.job'));
$this->assertSame($handler, $this->registry->getHandler('mail.job'));
}

public function testGetsHandlerWithWrongInterface(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/QueueInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testGetByContext(): void
$result = $injector->createInjection($reflection, 'test');
$result->push('foo');

self::assertInstanceOf(Queue::class, $result);
$this->assertInstanceOf(Queue::class, $result);
}

public function testGetByIncorrectContext(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Driver/NullDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function setUp(): void
public function testJobShouldBePushed(mixed $payload): void
{
$id = $this->queue->push('foo', $payload);
self::assertNotNull($id);
$this->assertNotNull($id);
}

public static function payloadDataProvider(): \Traversable
Expand Down
4 changes: 2 additions & 2 deletions tests/Driver/SyncDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testJobShouldBePushed(mixed $payload): void

$id = $this->queue->push('foo', $payload);

self::assertSame($uuid->toString(), $id);
$this->assertSame($uuid->toString(), $id);
}

public function testJobWithHeadersShouldBePushed(): void
Expand All @@ -84,7 +84,7 @@ public function testJobWithHeadersShouldBePushed(): void

$id = $this->queue->push('foo', ['baz' => 'baf'], $options);

self::assertSame($uuid->toString(), $id);
$this->assertSame($uuid->toString(), $id);
}

public static function payloadDataProvider(): \Traversable
Expand Down
26 changes: 13 additions & 13 deletions tests/Interceptor/Consume/RetryPolicyInterceptorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testWithoutException(): void
->with('foo', 'bar', [])
->willReturn('result');

self::assertSame('result', $this->interceptor->process('foo', 'bar', [], $this->core));
$this->assertSame('result', $this->interceptor->process('foo', 'bar', [], $this->core));
}

#[DataProvider('jobNameDataProvider')]
Expand Down Expand Up @@ -100,8 +100,8 @@ public function testWithDefaultRetryPolicy(string $name): void
try {
$this->interceptor->process($name, 'bar', [], $this->core);
} catch (RetryException $e) {
self::assertSame(1, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
$this->assertSame(1, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
}
}

Expand All @@ -121,8 +121,8 @@ public function testWithoutRetryPolicyAttribute(string $name): void
try {
$this->interceptor->process($name, 'bar', [], $this->core);
} catch (RetryException $e) {
self::assertSame(4, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
$this->assertSame(4, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
}
}

Expand All @@ -147,8 +147,8 @@ public function testWithRetryPolicyInAttribute(string $name): void
$this->core
);
} catch (RetryException $e) {
self::assertSame(8, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
$this->assertSame(8, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
}
}

Expand All @@ -175,8 +175,8 @@ public function testWithRetryPolicyInException(string $name): void
$this->core
);
} catch (RetryException $e) {
self::assertSame(8, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
$this->assertSame(8, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
}
}

Expand Down Expand Up @@ -213,8 +213,8 @@ public function getDelay(int $attempts = 0): int
$this->core
);
} catch (RetryException $e) {
self::assertSame(5, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
$this->assertSame(5, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
}
}

Expand Down Expand Up @@ -243,8 +243,8 @@ public function testWithRetryPolicyInExceptionInsideJobException(string $name):
$this->core
);
} catch (RetryException $e) {
self::assertSame(8, $e->getOptions()->getDelay());
self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
$this->assertSame(8, $e->getOptions()->getDelay());
$this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
}
}

Expand Down
Loading

0 comments on commit 594a395

Please sign in to comment.