Fix ECS formatting violations

This commit is contained in:
Bernard Ngandu
2025-10-10 16:30:14 +02:00
parent c24109d465
commit e62098d2c4
10 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace App\DataFixtures; namespace App\DataFixtures;
use App\ValueObject\Point;
use App\Entity\Signal; use App\Entity\Signal;
use App\ValueObject\Point;
use DateInterval; use DateInterval;
use DateTimeImmutable; use DateTimeImmutable;
use DateTimeZone; use DateTimeZone;
@@ -8,7 +8,9 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
use function sprintf; 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 final class InvalidPointException extends \RuntimeException
{ {
private function __construct(string $message) private function __construct(string $message)
@@ -7,7 +7,9 @@ namespace App\Exception;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; 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 final class MissingClientKeyException extends \RuntimeException
{ {
public function __construct() public function __construct()
@@ -8,7 +8,9 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
use function sprintf; 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 final class PointTooFarException extends \RuntimeException
{ {
public function __construct(float $maximumDistanceKm) public function __construct(float $maximumDistanceKm)
@@ -9,7 +9,9 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
use function sprintf; 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 final class SubmissionRateLimitedException extends \RuntimeException
{ {
public function __construct(?DateTimeInterface $retryAfter) public function __construct(?DateTimeInterface $retryAfter)
+3 -2
View File
@@ -6,7 +6,8 @@ namespace App\Message;
final class SignalCreatedMessage final class SignalCreatedMessage
{ {
public function __construct(public readonly int $signalId) public function __construct(
{ public readonly int $signalId
) {
} }
} }
@@ -9,14 +9,14 @@ use App\Repository\SignalRepository;
use App\Service\SignalSnapshotBuilder; use App\Service\SignalSnapshotBuilder;
use DateTimeImmutable; use DateTimeImmutable;
use DateTimeZone; use DateTimeZone;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Throwable;
use function json_encode; use function json_encode;
use const JSON_THROW_ON_ERROR; use const JSON_THROW_ON_ERROR;
use Throwable;
#[AsMessageHandler] #[AsMessageHandler]
final class SignalCreatedMessageHandler final class SignalCreatedMessageHandler
@@ -25,10 +25,8 @@ final class SignalCreatedMessageHandler
private readonly SignalRepository $signals, private readonly SignalRepository $signals,
private readonly SignalSnapshotBuilder $snapshotBuilder, private readonly SignalSnapshotBuilder $snapshotBuilder,
private readonly HubInterface $hub, private readonly HubInterface $hub,
#[Autowire('%app.signal_stream_topic%')] #[Autowire('%app.signal_stream_topic%')] private readonly string $topic,
private readonly string $topic, #[Autowire('%app.signal_snapshot_limit%')] private readonly int $snapshotLimit,
#[Autowire('%app.signal_snapshot_limit%')]
private readonly int $snapshotLimit,
private readonly ?LoggerInterface $logger = null, private readonly ?LoggerInterface $logger = null,
) { ) {
} }
@@ -4,19 +4,17 @@ declare(strict_types=1);
namespace App\Service; namespace App\Service;
use App\Exception\PointTooFarException;
use App\ValueObject\Distance; use App\ValueObject\Distance;
use App\ValueObject\Point; use App\ValueObject\Point;
use App\Exception\PointTooFarException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\Attribute\Autowire;
final class PointProximityValidator final class PointProximityValidator
{ {
public function __construct( public function __construct(
#[Autowire('%app.max_signal_distance_km%')] #[Autowire('%app.max_signal_distance_km%')] private readonly float $maximumDistanceKm,
private readonly float $maximumDistanceKm, #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger,
#[Autowire(service: 'monolog.logger.signals')]
private readonly LoggerInterface $logger,
) { ) {
} }
+2 -4
View File
@@ -15,10 +15,8 @@ final class SignalSnapshotService
public function __construct( public function __construct(
private readonly SignalRepository $signals, private readonly SignalRepository $signals,
private readonly SignalSnapshotBuilder $snapshotBuilder, private readonly SignalSnapshotBuilder $snapshotBuilder,
#[Autowire('%app.signal_snapshot_limit%')] #[Autowire('%app.signal_snapshot_limit%')] private readonly int $snapshotLimit,
private readonly int $snapshotLimit, #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger,
#[Autowire(service: 'monolog.logger.signals')]
private readonly LoggerInterface $logger,
) { ) {
} }
@@ -4,10 +4,10 @@ declare(strict_types=1);
namespace App\Service; namespace App\Service;
use App\Payload\SignalPayload;
use App\Entity\Signal; use App\Entity\Signal;
use App\Exception\SubmissionRateLimitedException; use App\Exception\SubmissionRateLimitedException;
use App\Message\SignalCreatedMessage; use App\Message\SignalCreatedMessage;
use App\Payload\SignalPayload;
use App\Repository\SignalRepository; use App\Repository\SignalRepository;
use DateTimeImmutable; use DateTimeImmutable;
use DateTimeZone; use DateTimeZone;
@@ -20,12 +20,10 @@ final class SignalSubmissionService
{ {
public function __construct( public function __construct(
private readonly SignalRepository $signals, private readonly SignalRepository $signals,
#[Autowire(service: 'limiter.signal_submission')] #[Autowire(service: 'limiter.signal_submission')] private readonly RateLimiterFactory $submissionLimiter,
private readonly RateLimiterFactory $submissionLimiter,
private readonly PointProximityValidator $proximityValidator, private readonly PointProximityValidator $proximityValidator,
private readonly MessageBusInterface $bus, private readonly MessageBusInterface $bus,
#[Autowire(service: 'monolog.logger.signals')] #[Autowire(service: 'monolog.logger.signals')] private readonly LoggerInterface $logger,
private readonly LoggerInterface $logger,
) { ) {
} }
@@ -91,5 +89,4 @@ final class SignalSubmissionService
'remaining_tokens' => $limit->getRemainingTokens(), 'remaining_tokens' => $limit->getRemainingTokens(),
]); ]);
} }
} }