From e62098d2c4a448e960c0d036b3e313f5406b1964 Mon Sep 17 00:00:00 2001 From: Bernard Ngandu <31113941+bernard-ng@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:30:14 +0200 Subject: [PATCH] Fix ECS formatting violations --- server/src/DataFixtures/SignalFixtures.php | 2 +- server/src/Exception/InvalidPointException.php | 4 +++- server/src/Exception/MissingClientKeyException.php | 4 +++- server/src/Exception/PointTooFarException.php | 4 +++- .../src/Exception/SubmissionRateLimitedException.php | 4 +++- server/src/Message/SignalCreatedMessage.php | 5 +++-- .../MessageHandler/SignalCreatedMessageHandler.php | 12 +++++------- server/src/Service/PointProximityValidator.php | 8 +++----- server/src/Service/SignalSnapshotService.php | 6 ++---- server/src/Service/SignalSubmissionService.php | 9 +++------ 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/server/src/DataFixtures/SignalFixtures.php b/server/src/DataFixtures/SignalFixtures.php index 28e9d15..e416e59 100644 --- a/server/src/DataFixtures/SignalFixtures.php +++ b/server/src/DataFixtures/SignalFixtures.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace App\DataFixtures; -use App\ValueObject\Point; use App\Entity\Signal; +use App\ValueObject\Point; use DateInterval; use DateTimeImmutable; use DateTimeZone; diff --git a/server/src/Exception/InvalidPointException.php b/server/src/Exception/InvalidPointException.php index 4b15d87..8d62f6c 100644 --- a/server/src/Exception/InvalidPointException.php +++ b/server/src/Exception/InvalidPointException.php @@ -8,7 +8,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use function sprintf; -#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: ['x-error-code' => 'invalid_coordinates'])] +#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: [ + 'x-error-code' => 'invalid_coordinates', +])] final class InvalidPointException extends \RuntimeException { private function __construct(string $message) diff --git a/server/src/Exception/MissingClientKeyException.php b/server/src/Exception/MissingClientKeyException.php index 64103b1..a3fc0d0 100644 --- a/server/src/Exception/MissingClientKeyException.php +++ b/server/src/Exception/MissingClientKeyException.php @@ -7,7 +7,9 @@ namespace App\Exception; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; -#[WithHttpStatus(Response::HTTP_BAD_REQUEST, headers: ['x-error-code' => 'missing_client_key'])] +#[WithHttpStatus(Response::HTTP_BAD_REQUEST, headers: [ + 'x-error-code' => 'missing_client_key', +])] final class MissingClientKeyException extends \RuntimeException { public function __construct() diff --git a/server/src/Exception/PointTooFarException.php b/server/src/Exception/PointTooFarException.php index 9138ed7..2b8ef88 100644 --- a/server/src/Exception/PointTooFarException.php +++ b/server/src/Exception/PointTooFarException.php @@ -8,7 +8,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use function sprintf; -#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: ['x-error-code' => 'point_too_far'])] +#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: [ + 'x-error-code' => 'point_too_far', +])] final class PointTooFarException extends \RuntimeException { public function __construct(float $maximumDistanceKm) diff --git a/server/src/Exception/SubmissionRateLimitedException.php b/server/src/Exception/SubmissionRateLimitedException.php index 36b7ec8..b6e63f4 100644 --- a/server/src/Exception/SubmissionRateLimitedException.php +++ b/server/src/Exception/SubmissionRateLimitedException.php @@ -9,7 +9,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use function sprintf; -#[WithHttpStatus(Response::HTTP_TOO_MANY_REQUESTS, headers: ['x-error-code' => 'submission_rate_limited'])] +#[WithHttpStatus(Response::HTTP_TOO_MANY_REQUESTS, headers: [ + 'x-error-code' => 'submission_rate_limited', +])] final class SubmissionRateLimitedException extends \RuntimeException { public function __construct(?DateTimeInterface $retryAfter) diff --git a/server/src/Message/SignalCreatedMessage.php b/server/src/Message/SignalCreatedMessage.php index 41a9623..a28ec50 100644 --- a/server/src/Message/SignalCreatedMessage.php +++ b/server/src/Message/SignalCreatedMessage.php @@ -6,7 +6,8 @@ namespace App\Message; final class SignalCreatedMessage { - public function __construct(public readonly int $signalId) - { + public function __construct( + public readonly int $signalId + ) { } } diff --git a/server/src/MessageHandler/SignalCreatedMessageHandler.php b/server/src/MessageHandler/SignalCreatedMessageHandler.php index 963a1e0..6481333 100644 --- a/server/src/MessageHandler/SignalCreatedMessageHandler.php +++ b/server/src/MessageHandler/SignalCreatedMessageHandler.php @@ -9,14 +9,14 @@ use App\Repository\SignalRepository; use App\Service\SignalSnapshotBuilder; use DateTimeImmutable; use DateTimeZone; -use Symfony\Component\Mercure\HubInterface; -use Symfony\Component\Mercure\Update; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; +use Symfony\Component\Mercure\HubInterface; +use Symfony\Component\Mercure\Update; use Symfony\Component\Messenger\Attribute\AsMessageHandler; +use Throwable; use function json_encode; use const JSON_THROW_ON_ERROR; -use Throwable; #[AsMessageHandler] final class SignalCreatedMessageHandler @@ -25,10 +25,8 @@ final class SignalCreatedMessageHandler private readonly SignalRepository $signals, private readonly SignalSnapshotBuilder $snapshotBuilder, private readonly HubInterface $hub, - #[Autowire('%app.signal_stream_topic%')] - private readonly string $topic, - #[Autowire('%app.signal_snapshot_limit%')] - private readonly int $snapshotLimit, + #[Autowire('%app.signal_stream_topic%')] private readonly string $topic, + #[Autowire('%app.signal_snapshot_limit%')] private readonly int $snapshotLimit, private readonly ?LoggerInterface $logger = null, ) { } diff --git a/server/src/Service/PointProximityValidator.php b/server/src/Service/PointProximityValidator.php index 1839b0a..75c18c2 100644 --- a/server/src/Service/PointProximityValidator.php +++ b/server/src/Service/PointProximityValidator.php @@ -4,19 +4,17 @@ declare(strict_types=1); namespace App\Service; +use App\Exception\PointTooFarException; use App\ValueObject\Distance; use App\ValueObject\Point; -use App\Exception\PointTooFarException; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; final class PointProximityValidator { public function __construct( - #[Autowire('%app.max_signal_distance_km%')] - private readonly float $maximumDistanceKm, - #[Autowire(service: 'monolog.logger.signals')] - private readonly LoggerInterface $logger, + #[Autowire('%app.max_signal_distance_km%')] private readonly float $maximumDistanceKm, + #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger, ) { } diff --git a/server/src/Service/SignalSnapshotService.php b/server/src/Service/SignalSnapshotService.php index c976264..8a02034 100644 --- a/server/src/Service/SignalSnapshotService.php +++ b/server/src/Service/SignalSnapshotService.php @@ -15,10 +15,8 @@ final class SignalSnapshotService public function __construct( private readonly SignalRepository $signals, private readonly SignalSnapshotBuilder $snapshotBuilder, - #[Autowire('%app.signal_snapshot_limit%')] - private readonly int $snapshotLimit, - #[Autowire(service: 'monolog.logger.signals')] - private readonly LoggerInterface $logger, + #[Autowire('%app.signal_snapshot_limit%')] private readonly int $snapshotLimit, + #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger, ) { } diff --git a/server/src/Service/SignalSubmissionService.php b/server/src/Service/SignalSubmissionService.php index 54b87e3..9422cec 100644 --- a/server/src/Service/SignalSubmissionService.php +++ b/server/src/Service/SignalSubmissionService.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace App\Service; -use App\Payload\SignalPayload; use App\Entity\Signal; use App\Exception\SubmissionRateLimitedException; use App\Message\SignalCreatedMessage; +use App\Payload\SignalPayload; use App\Repository\SignalRepository; use DateTimeImmutable; use DateTimeZone; @@ -20,12 +20,10 @@ final class SignalSubmissionService { public function __construct( private readonly SignalRepository $signals, - #[Autowire(service: 'limiter.signal_submission')] - private readonly RateLimiterFactory $submissionLimiter, + #[Autowire(service: 'limiter.signal_submission')] private readonly RateLimiterFactory $submissionLimiter, private readonly PointProximityValidator $proximityValidator, private readonly MessageBusInterface $bus, - #[Autowire(service: 'monolog.logger.signals')] - private readonly LoggerInterface $logger, + #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger, ) { } @@ -91,5 +89,4 @@ final class SignalSubmissionService 'remaining_tokens' => $limit->getRemainingTokens(), ]); } - }