apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -13,17 +13,12 @@ namespace Chill\MainBundle\Notification;
use Chill\MainBundle\Entity\User;
use Psr\Log\LoggerInterface;
use Swift_Mailer;
use Swift_Message;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment;
use function call_user_func;
/**
* Class Mailer
* Classe d'aide pour l'envoi de notification.
@@ -37,19 +32,16 @@ class Mailer
/**
* Mailer constructor.
*
* @param $routeParameters
* @param mixed[] $routeParameters
*/
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly \Twig\Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) {}
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) {}
/**
* @param $template
* @return string
*
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
*
* @return string
*/
public function renderContentToUser(User $to, $template, array $parameters = [])
{
@@ -72,15 +64,15 @@ class Mailer
/**
* Envoie une notification à un utilisateur.
*
* @param array $subject Subject of the message [ 0 => $message (required), 1 => $parameters (optional), 3 => $domain (optional) ]
* @param array $bodies The bodies. An array where keys are the contentType and values the bodies
* @param array $subject Subject of the message [ 0 => $message (required), 1 => $parameters (optional), 3 => $domain (optional) ]
* @param array $bodies The bodies. An array where keys are the contentType and values the bodies
* @param callable $callback a callback to customize the message (add attachment, etc.)
*/
public function sendNotification(
mixed $recipient,
array $subject,
array $bodies,
?callable $callback = null,
callable $callback = null,
mixed $force = false
) {
$fromEmail = $this->routeParameters['from_email'];
@@ -104,12 +96,12 @@ class Mailer
}
if (null !== $callback) {
call_user_func($callback, $email);
\call_user_func($callback, $email);
}
$this->logger->info('[notification] Sending notification', [
'to' => $email->getTo(),
'subject' => $email->getSubject()
'subject' => $email->getSubject(),
]);
$this->mailer->send($email);