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:
@@ -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}>
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user