fix: SonarQube - methode inutilisee, return type, PHPDoc, catch vides

- StatsController : suppression getPaymentsByMethod() inutilisee
- OrderPaymentController : handleVerifyPost return type string|true (sans null)
- SeoService : PHPDoc parseSslCertificate simplifie
- TarificationController : commentaires dans catch vides

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-04-08 13:51:27 +02:00
parent e2ef53e2b6
commit 799af4c551
4 changed files with 5 additions and 34 deletions

View File

@@ -172,37 +172,6 @@ class StatsController extends AbstractController
];
}
/**
* @return list<array{method: string, total: float, count: int}>
*/
private function getPaymentsByMethod(\DateTimeImmutable $from, \DateTimeImmutable $to): array
{
$payments = $this->em->createQueryBuilder()
->select('p')
->from(AdvertPayment::class, 'p')
->where('p.createdAt BETWEEN :from AND :to')
->andWhere('p.type = :type')
->setParameter('from', $from)
->setParameter('to', $to)
->setParameter('type', AdvertPayment::TYPE_SUCCESS)
->getQuery()
->getResult();
$grouped = [];
foreach ($payments as $p) {
$method = $p->getMethod() ?? 'inconnu';
if (!isset($grouped[$method])) {
$grouped[$method] = ['method' => $method, 'total' => 0.0, 'count' => 0];
}
$grouped[$method]['total'] += (float) $p->getAmount();
++$grouped[$method]['count'];
}
usort($grouped, /** @param array{method: string, total: float, count: int} $a @param array{method: string, total: float, count: int} $b */ fn (array $a, array $b) => $b['total'] <=> $a['total']);
return $grouped;
}
/**
* @return list<array{month: string, ca_ht: float, ca_ttc: float}>
*/

View File

@@ -94,6 +94,7 @@ class TarificationController extends AbstractController
\Stripe\Stripe::setApiKey($stripeSk);
\Stripe\Product::update($price->getStripeId(), ['active' => false]);
} catch (\Throwable) {
// Stripe desactivation best-effort
}
}
@@ -101,6 +102,7 @@ class TarificationController extends AbstractController
try {
$meilisearch->removePrice($price->getId());
} catch (\Throwable) {
// Meilisearch cleanup best-effort
}
$em->remove($price);

View File

@@ -93,7 +93,7 @@ class OrderPaymentController extends AbstractController
}
/**
* @return string|true|null string=error message, true=code valid (redirect), null=not POST
* @return string|true string=error message, true=code valid (redirect)
*/
private function handleVerifyPost(
\Symfony\Component\HttpFoundation\Request $request,
@@ -101,7 +101,7 @@ class OrderPaymentController extends AbstractController
\Symfony\Component\HttpFoundation\Session\SessionInterface $session,
string $sessionKey,
string $numOrder,
): string|true|null {
): string|true {
$codeKey = 'order_code_'.$advert->getId();
$codeExpiresKey = 'order_code_expires_'.$advert->getId();
$code = trim($request->request->getString('code'));

View File

@@ -257,7 +257,7 @@ class SeoService
}
/**
* @param array{is_https: bool, valid: bool, issuer: ?string, expires: ?string, days_remaining: ?int, issues: list<string>} $result
* @param array<string, mixed> $result
*/
private function parseSslCertificate(string $host, int|string $port, array &$result): void
{