Remove always-true condition in handlePayout

User is guaranteed non-null after early return refactoring

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 09:20:15 +01:00
parent 8257615c32
commit da0ddf639b

View File

@@ -138,29 +138,27 @@ class StripeWebhookController extends AbstractController
$em->flush();
if ($user) {
$attachments = null;
$attachments = null;
if ('paid' === $payout->getStatus()) {
$pdfPath = $pdfService->generateToFile($payout);
$attachments = [['path' => $pdfPath, 'name' => 'attestation_'.$payout->getStripePayoutId().'.pdf']];
}
$mailerService->sendEmail(
to: $user->getEmail(),
subject: sprintf('Virement %s - E-Ticket', strtoupper($payout->getStatus())),
content: $this->renderView('email/payout_update.html.twig', [
'firstName' => $user->getFirstName(),
'payoutId' => $payout->getStripePayoutId(),
'amount' => number_format($payout->getAmountDecimal(), 2, ',', ' '),
'currency' => $payout->getCurrency(),
'status' => $payout->getStatus(),
'arrivalDate' => $payout->getArrivalDate()?->format('d/m/Y'),
]),
withUnsubscribe: false,
attachments: $attachments,
);
if ('paid' === $payout->getStatus()) {
$pdfPath = $pdfService->generateToFile($payout);
$attachments = [['path' => $pdfPath, 'name' => 'attestation_'.$payout->getStripePayoutId().'.pdf']];
}
$mailerService->sendEmail(
to: $user->getEmail(),
subject: sprintf('Virement %s - E-Ticket', strtoupper($payout->getStatus())),
content: $this->renderView('email/payout_update.html.twig', [
'firstName' => $user->getFirstName(),
'payoutId' => $payout->getStripePayoutId(),
'amount' => number_format($payout->getAmountDecimal(), 2, ',', ' '),
'currency' => $payout->getCurrency(),
'status' => $payout->getStatus(),
'arrivalDate' => $payout->getArrivalDate()?->format('d/m/Y'),
]),
withUnsubscribe: false,
attachments: $attachments,
);
}
/**