Fix PHPStan errors and SonarQube warnings
- Remove redundant && $fix checks in MeilisearchConsistencyCommand (always true after early return) - Add @param PHPDoc for Attestation::__construct $payload parameter - Extract PDF_SUFFIX constant to avoid duplicated ".pdf"" literal Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,7 +180,7 @@ class MeilisearchConsistencyCommand extends Command
|
|||||||
$dbEvents = $this->em->getRepository(Event::class)->findAll();
|
$dbEvents = $this->em->getRepository(Event::class)->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$indexExists && $fix) {
|
if (!$indexExists) {
|
||||||
$this->meilisearch->request('POST', self::INDEXES_ENDPOINT, ['uid' => $index, 'primaryKey' => 'id']);
|
$this->meilisearch->request('POST', self::INDEXES_ENDPOINT, ['uid' => $index, 'primaryKey' => 'id']);
|
||||||
$io->text(sprintf(' [%s] Created index, indexing %d event(s)', $index, \count($dbEvents)));
|
$io->text(sprintf(' [%s] Created index, indexing %d event(s)', $index, \count($dbEvents)));
|
||||||
foreach ($dbEvents as $event) {
|
foreach ($dbEvents as $event) {
|
||||||
@@ -223,7 +223,7 @@ class MeilisearchConsistencyCommand extends Command
|
|||||||
|
|
||||||
$dbOrders = $this->em->getRepository(BilletBuyer::class)->findBy(['event' => $event]);
|
$dbOrders = $this->em->getRepository(BilletBuyer::class)->findBy(['event' => $event]);
|
||||||
|
|
||||||
if (!$indexExists && $fix) {
|
if (!$indexExists) {
|
||||||
$this->meilisearch->request('POST', self::INDEXES_ENDPOINT, ['uid' => $index, 'primaryKey' => 'id']);
|
$this->meilisearch->request('POST', self::INDEXES_ENDPOINT, ['uid' => $index, 'primaryKey' => 'id']);
|
||||||
$io->text(sprintf(' [%s] Created index, indexing %d order(s)', $index, \count($dbOrders)));
|
$io->text(sprintf(' [%s] Created index, indexing %d order(s)', $index, \count($dbOrders)));
|
||||||
foreach ($dbOrders as $order) {
|
foreach ($dbOrders as $order) {
|
||||||
@@ -265,7 +265,7 @@ class MeilisearchConsistencyCommand extends Command
|
|||||||
|
|
||||||
$dbUsers = $this->filterUsers($isOrganizer);
|
$dbUsers = $this->filterUsers($isOrganizer);
|
||||||
|
|
||||||
if (!$indexExists && $fix) {
|
if (!$indexExists) {
|
||||||
return $this->createUserIndex($index, $dbUsers, $isOrganizer, $io);
|
return $this->createUserIndex($index, $dbUsers, $isOrganizer, $io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class AccountController extends AbstractController
|
|||||||
private const DQL_EXCLUDE_INVITATIONS = 'o.isInvitation = false OR o.isInvitation IS NULL';
|
private const DQL_EXCLUDE_INVITATIONS = 'o.isInvitation = false OR o.isInvitation IS NULL';
|
||||||
private const DQL_BB_EXCLUDE_INVITATIONS = 'bb.isInvitation = false OR bb.isInvitation IS NULL';
|
private const DQL_BB_EXCLUDE_INVITATIONS = 'bb.isInvitation = false OR bb.isInvitation IS NULL';
|
||||||
private const CONTENT_TYPE_PDF = 'application/pdf';
|
private const CONTENT_TYPE_PDF = 'application/pdf';
|
||||||
|
private const PDF_SUFFIX = '.pdf"';
|
||||||
|
|
||||||
#[Route('/mon-compte', name: 'app_account')]
|
#[Route('/mon-compte', name: 'app_account')]
|
||||||
public function index(Request $request, StripeService $stripeService, EntityManagerInterface $em, PaginatorInterface $paginator, EventIndexService $eventIndex): Response
|
public function index(Request $request, StripeService $stripeService, EntityManagerInterface $em, PaginatorInterface $paginator, EventIndexService $eventIndex): Response
|
||||||
@@ -952,7 +953,7 @@ class AccountController extends AbstractController
|
|||||||
|
|
||||||
return new Response($pdf, 200, [
|
return new Response($pdf, 200, [
|
||||||
'Content-Type' => self::CONTENT_TYPE_PDF,
|
'Content-Type' => self::CONTENT_TYPE_PDF,
|
||||||
'Content-Disposition' => 'inline; filename="'.$ticket->getReference().'.pdf"',
|
'Content-Disposition' => 'inline; filename="'.$ticket->getReference().self::PDF_SUFFIX,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,7 +1084,7 @@ class AccountController extends AbstractController
|
|||||||
|
|
||||||
return new Response($dompdf->output(), 200, [
|
return new Response($dompdf->output(), 200, [
|
||||||
'Content-Type' => self::CONTENT_TYPE_PDF,
|
'Content-Type' => self::CONTENT_TYPE_PDF,
|
||||||
'Content-Disposition' => 'inline; filename="attestation_'.$event->getSlug().'_'.date('Y-m-d').'.pdf"',
|
'Content-Disposition' => 'inline; filename="attestation_'.$event->getSlug().'_'.date('Y-m-d').self::PDF_SUFFIX,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1387,7 +1388,7 @@ class AccountController extends AbstractController
|
|||||||
|
|
||||||
return new Response($pdfService->generate($payout), 200, [
|
return new Response($pdfService->generate($payout), 200, [
|
||||||
'Content-Type' => self::CONTENT_TYPE_PDF,
|
'Content-Type' => self::CONTENT_TYPE_PDF,
|
||||||
'Content-Disposition' => 'inline; filename="attestation_'.$payout->getStripePayoutId().'.pdf"',
|
'Content-Disposition' => 'inline; filename="attestation_'.$payout->getStripePayoutId().self::PDF_SUFFIX,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class Attestation
|
|||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
private \DateTimeImmutable $createdAt;
|
private \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
|
/** @param array<string, mixed> $payload */
|
||||||
public function __construct(string $reference, string $signatureHash, Event $event, User $generatedBy, int $totalSold, array $payload)
|
public function __construct(string $reference, string $signatureHash, Event $event, User $generatedBy, int $totalSold, array $payload)
|
||||||
{
|
{
|
||||||
$this->reference = $reference;
|
$this->reference = $reference;
|
||||||
|
|||||||
Reference in New Issue
Block a user