Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
},
"require": {
"php": "^8.4",
"php": "^8.5",
"ext-apcu": "*",
"ext-pcntl": "*",
"ext-posix": "*",
Expand Down Expand Up @@ -80,7 +80,7 @@
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-doctrine": "^2.0",
"phpunit/phpunit": "^10.3",
"phpunit/phpunit": "^12.5",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.11",
"symfony/debug-bundle": "^7.0",
Expand Down
4,084 changes: 2,217 additions & 1,867 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/chat/services/consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:

chat.transient-rpc-message-handler.topology:
class: Gaming\Common\MessageBroker\Integration\AmqpLib\Topology\QueueTopology
arguments: ['Chat.TransientRpc', 'gaming', ['Chat.TransientRpc'], {'x-message-ttl': 7000}]]
arguments: ['Chat.TransientRpc', 'gaming', ['Chat.TransientRpc'], { 'x-message-ttl': 7000 }]
tags: [{ name: 'gaming.message-broker.topology' }]

chat.transient-rpc-message-handler.consumer:
Expand Down
6 changes: 3 additions & 3 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ services:
Gaming\Common\SymfonyPrometheus\CollectMetricsListener:
arguments: ['@gaming.prometheus.registry', 'app']
tags:
- { name: kernel.event_listener, event: kernel.request, priority: 1024 }]
- { name: kernel.event_listener, event: kernel.response, priority: -1024 }]
- { name: kernel.event_listener, event: kernel.exception, priority: 1024 }]
- { name: kernel.event_listener, event: kernel.request, priority: 1024 }
- { name: kernel.event_listener, event: kernel.response, priority: -1024 }
- { name: kernel.event_listener, event: kernel.exception, priority: 1024 }

Gaming\Common\DoctrinePrometheusMiddleware\CollectMetricsMiddleware:
arguments: ['@gaming.prometheus.registry', 'app']
Expand Down
2 changes: 1 addition & 1 deletion config/connect-four/services/consumer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
connect-four.transient-rpc-message-handler.topology:
class: Gaming\Common\MessageBroker\Integration\AmqpLib\Topology\QueueTopology
arguments: ['ConnectFour.TransientRpc', 'gaming', ['ConnectFour.TransientRpc'], {'x-message-ttl': 7000}]]
arguments: ['ConnectFour.TransientRpc', 'gaming', ['ConnectFour.TransientRpc'], { 'x-message-ttl': 7000 }]
tags: [{ name: 'gaming.message-broker.topology' }]

connect-four.transient-rpc-message-handler.consumer:
Expand Down
1 change: 1 addition & 0 deletions config/identity/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ doctrine:
charset: utf8mb4
collate: utf8mb4_unicode_ci
orm:
enable_native_lazy_objects: true
entity_managers:
identity:
connection: identity
Expand Down
2 changes: 1 addition & 1 deletion config/identity/services/consumer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
identity.transient-rpc-message-handler.topology:
class: Gaming\Common\MessageBroker\Integration\AmqpLib\Topology\QueueTopology
arguments: ['Identity.TransientRpc', 'gaming', ['Identity.TransientRpc'], {'x-message-ttl': 7000}]]
arguments: ['Identity.TransientRpc', 'gaming', ['Identity.TransientRpc'], { 'x-message-ttl': 7000 }]
tags: [{ name: 'gaming.message-broker.topology' }]

identity.transient-rpc-message-handler.consumer:
Expand Down
4 changes: 2 additions & 2 deletions config/routing_dev.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
resource: '@WebProfilerBundle/Resources/config/routing/wdt.php'
prefix: /_wdt

_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
resource: '@WebProfilerBundle/Resources/config/routing/profiler.php'
prefix: /_profiler

_main:
Expand Down
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG environment=development
##############################
# Build dependencies #
##############################
FROM ghcr.io/gaming-platform/docker-php-fpm:8.4-development as builder
FROM ghcr.io/gaming-platform/docker-php-fpm:8.5-development AS builder

ARG environment=development

Expand All @@ -19,7 +19,7 @@ RUN /composer-install-after-code-copy.sh
##############################
# Build php-fpm #
##############################
FROM ghcr.io/gaming-platform/docker-php-fpm:8.4-$environment
FROM ghcr.io/gaming-platform/docker-php-fpm:8.5-$environment

ARG environment=development

Expand All @@ -31,7 +31,8 @@ COPY --from=builder /project /project

RUN /warmup.sh

COPY /docker/${environment}.ini /etc/php/8.4/fpm/conf.d/
COPY /docker/fpm/${environment}.ini /etc/php/8.5/fpm/conf.d/
COPY /docker/cli/${environment}.ini /etc/php/8.5/cli/conf.d/

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-http"]
1 change: 1 addition & 0 deletions docker/cli/development.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
register_argc_argv = 1
1 change: 1 addition & 0 deletions docker/cli/production.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
register_argc_argv = 1
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ parameters:
ignoreErrors:
# Ignoring non-empty-string because there are currently many false positives.
- message: '#(should return|expects) non-empty-string( but returns string|, string given)\.$#'
- message: '#^Call to an undefined method Symfony[^:]+::children\(\)\.$#'
- message: '#^While loop condition is always true\.$#'
- message: "#^Property Gaming\\\\Identity\\\\Domain\\\\Model\\\\Account\\\\Account\\:\\:\\$version#"
- message: "#^Property Gaming\\\\Memory\\\\Domain\\\\Model\\\\Game\\\\Game\\:\\:\\$cards is never read, only written\\.$#"
Expand Down
6 changes: 3 additions & 3 deletions src/Common/MessageBroker/Integration/AmqpLib/AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class AmqpConsumer implements Consumer
/**
* @var ArrayObject<int, AmqpContext>
*/
private readonly ArrayObject $pendingMessageToContext;
private ArrayObject $pendingMessageToContext;

/**
* @param positive-int $prefetchCount
Expand Down Expand Up @@ -84,13 +84,13 @@ public function stop(): void

private function onPositiveAcknowledgement(AMQPMessage $pendingMessage): void
{
$this->pendingMessageToContext[$pendingMessage->getDeliveryTag()]
($this->pendingMessageToContext[$pendingMessage->getDeliveryTag()] ?? null)
?->resolvePositiveAcknowledgement($pendingMessage);
}

private function onNegativeAcknowledgement(AMQPMessage $pendingMessage): void
{
$this->pendingMessageToContext[$pendingMessage->getDeliveryTag()]
($this->pendingMessageToContext[$pendingMessage->getDeliveryTag()] ?? null)
?->resolveNegativeAcknowledgement($pendingMessage);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Timer/TimeoutService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function add(array $timeouts): void
}

/**
* @param string[] $timeoutIds
* @param list<string> $timeoutIds
*/
public function remove(array $timeoutIds): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Timer/TimeoutStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface TimeoutStore
public function add(array $timeouts): void;

/**
* @param string[] $timeoutIds
* @param list<string> $timeoutIds
*/
public function remove(array $timeoutIds): void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class TimerProjection implements StoredEventSubscriber
private array $additions = [];

/**
* @var string[]
* @var list<string>
*/
private array $removals = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

namespace Gaming\Tests\Integration\Common\DoctrineHeartbeatMiddleware;

use Codeception\Attribute\DataProvider;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Logging\Middleware as LoggerMiddleware;
use Doctrine\DBAL\Tools\DsnParser;
use Gaming\Common\DoctrineHeartbeatMiddleware\SchedulePeriodicHeartbeatMiddleware;
use Gaming\Common\Scheduler\TestScheduler;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Clock\ClockInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Clock\MockClock;

final class SchedulePeriodicHeartbeatMiddlewareTest extends TestCase
{
/**
* @test
*/
#[Test]
public function itShouldScheduleHeartbeatsUntilClosed(): void
{
$scheduler = new TestScheduler();
Expand Down Expand Up @@ -57,10 +57,8 @@ public function itShouldScheduleHeartbeatsUntilClosed(): void
self::assertSame(0, $scheduler->numberOfPendingJobs());
}

/**
* @test
* @dataProvider withoutHeartbeatDataProvider
*/
#[Test]
#[DataProvider('withoutHeartbeatDataProvider')]
public function itShouldNotScheduleWithoutHeartbeatConfiguration(string $url, int $heartbeat): void
{
$scheduler = new TestScheduler();
Expand Down
20 changes: 7 additions & 13 deletions tests/unit/Chat/Application/ChatIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,24 @@

namespace Gaming\Tests\Unit\Chat\Application;

use Codeception\Attribute\DataProvider;
use Gaming\Chat\Application\ChatId;
use Gaming\Chat\Application\Exception\ChatNotFoundException;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Uid\Uuid;

class ChatIdTest extends TestCase
{
/**
* @test
*/
#[Test]
public function itCanBeGenerated(): void
{
$chatId = ChatId::generate();

$this->assertTrue(Uuid::isValid($chatId->toString()));
}

/**
* @test
*/
#[Test]
public function itCanBeCreatedFromString(): void
{
$expected = Uuid::v6()->toRfc4122();
Expand All @@ -33,9 +31,7 @@ public function itCanBeCreatedFromString(): void
$this->assertSame($expected, $chatId->toString());
}

/**
* @test
*/
#[Test]
public function itCanBeTypeCastedToString(): void
{
$chatId = ChatId::generate();
Expand All @@ -44,10 +40,8 @@ public function itCanBeTypeCastedToString(): void
$this->assertTrue(Uuid::isValid((string)$chatId));
}

/**
* @test
* @dataProvider invalidStringProvider
*/
#[Test]
#[DataProvider('invalidStringProvider')]
public function itShouldThrowChatNotFoundExceptionOnInvalidString(string $invalidString): void
{
$this->expectException(ChatNotFoundException::class);
Expand Down
21 changes: 6 additions & 15 deletions tests/unit/Chat/Application/ChatServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
use Gaming\Common\EventStore\DomainEvent;
use Gaming\Common\EventStore\InMemoryEventStore;
use Gaming\Common\IdempotentStorage\InMemoryIdempotentStorage;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Clock\MockClock;

final class ChatServiceTest extends TestCase
{
/**
* @test
*/
#[Test]
public function itShouldInitiateChatExactlyOnce(): void
{
$expectedChatId = ChatId::generate();
Expand Down Expand Up @@ -70,9 +69,7 @@ public function itShouldInitiateChatExactlyOnce(): void
);
}

/**
* @test
*/
#[Test]
public function itShouldThrowMessageEmptyException(): void
{
$this->expectException(EmptyMessageException::class);
Expand All @@ -94,9 +91,7 @@ public function itShouldThrowMessageEmptyException(): void
);
}

/**
* @test
*/
#[Test]
public function itShouldAllowOnlyAuthorsAssignedToChat(): void
{
$this->expectException(AuthorNotAllowedException::class);
Expand Down Expand Up @@ -127,9 +122,7 @@ public function itShouldAllowOnlyAuthorsAssignedToChat(): void
);
}

/**
* @test
*/
#[Test]
public function itShouldWriteMessage(): void
{
$clock = new MockClock();
Expand Down Expand Up @@ -182,9 +175,7 @@ public function itShouldWriteMessage(): void
);
}

/**
* @test
*/
#[Test]
public function itShouldReturnMessages(): void
{
$chatId = ChatId::generate();
Expand Down
9 changes: 3 additions & 6 deletions tests/unit/Common/Bus/Integration/SymfonyValidatorBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Gaming\Common\Domain\Exception\DomainException;
use Gaming\Common\Domain\Exception\Violation;
use Gaming\Common\Domain\Exception\ViolationParameter;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationInterface;
Expand All @@ -19,9 +20,7 @@

class SymfonyValidatorBusTest extends TestCase
{
/**
* @test
*/
#[Test]
public function itShouldForwardRequestToHandlerAndReturnItsValue(): void
{
$request = $this->createRequest('Request');
Expand All @@ -48,9 +47,7 @@ public function itShouldForwardRequestToHandlerAndReturnItsValue(): void
$this->assertSame($response, $bus->handle($request));
}

/**
* @test
*/
#[Test]
public function itShouldThrowDomainExceptionWithViolationsOnError(): void
{
$this->expectException(DomainException::class);
Expand Down
13 changes: 4 additions & 9 deletions tests/unit/Common/Bus/PsrCallableRoutingBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@
use Gaming\Tests\Unit\Common\Bus\Fixture\FirstRequest;
use Gaming\Tests\Unit\Common\Bus\Fixture\SecondRequest;
use Gaming\Tests\Unit\Common\Bus\Fixture\UniversalHandler;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class PsrCallableRoutingBusTest extends TestCase
{
/**
* @test
*/
#[Test]
public function itShouldThrowMissingHandlerException(): void
{
$this->expectException(BusException::class);

(new PsrCallableRoutingBus(new TestContainer()))->handle(new FirstRequest());
}

/**
* @test
*/
#[Test]
public function itShouldThrowMissingHandlerExceptionIfHandlerIsNotCallable(): void
{
$this->expectException(BusException::class);
Expand All @@ -40,9 +37,7 @@ public function itShouldThrowMissingHandlerExceptionIfHandlerIsNotCallable(): vo
$bus->handle(new FirstRequest());
}

/**
* @test
*/
#[Test]
public function itShouldRouteRequestToHandlerAndReturnItsValue(): void
{
$bus = new PsrCallableRoutingBus(
Expand Down
Loading