mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -25,14 +25,8 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
final class NotificationByUserCounter implements NotificationCounterInterface
|
||||
{
|
||||
private CacheItemPoolInterface $cacheItemPool;
|
||||
|
||||
private NotificationRepository $notificationRepository;
|
||||
|
||||
public function __construct(CacheItemPoolInterface $cacheItemPool, NotificationRepository $notificationRepository)
|
||||
public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository)
|
||||
{
|
||||
$this->cacheItemPool = $cacheItemPool;
|
||||
$this->notificationRepository = $notificationRepository;
|
||||
}
|
||||
|
||||
public function addNotification(UserInterface $u): int
|
||||
|
@@ -25,17 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class NotificationMailer
|
||||
{
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private MailerInterface $mailer;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(MailerInterface $mailer, LoggerInterface $logger, TranslatorInterface $translator)
|
||||
public function __construct(private MailerInterface $mailer, private LoggerInterface $logger, private TranslatorInterface $translator)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
$this->logger = $logger;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void
|
||||
|
@@ -19,14 +19,8 @@ use function count;
|
||||
|
||||
class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private NotificationPersisterInterface $persister;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, NotificationPersisterInterface $persister)
|
||||
public function __construct(private EntityManagerInterface $em, private NotificationPersisterInterface $persister)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->persister = $persister;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
|
@@ -39,11 +39,6 @@ class Mailer
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $routeParameters;
|
||||
|
||||
/**
|
||||
* @var RouterInterface
|
||||
*/
|
||||
@@ -62,6 +57,7 @@ class Mailer
|
||||
* Mailer constructor.
|
||||
*
|
||||
* @param $routeParameters
|
||||
* @param mixed[] $routeParameters
|
||||
*/
|
||||
public function __construct(
|
||||
MailerInterface $mailer,
|
||||
@@ -69,14 +65,13 @@ class Mailer
|
||||
EngineInterface $twig,
|
||||
RouterInterface $router,
|
||||
TranslatorInterface $translator,
|
||||
$routeParameters
|
||||
protected $routeParameters
|
||||
) {
|
||||
$this->logger = $logger;
|
||||
$this->twig = $twig;
|
||||
$this->mailer = $mailer;
|
||||
$this->router = $router;
|
||||
$this->translator = $translator;
|
||||
$this->routeParameters = $routeParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,15 +107,13 @@ class Mailer
|
||||
* @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.)
|
||||
* @param mixed $recipient
|
||||
* @param mixed $force
|
||||
*/
|
||||
public function sendNotification(
|
||||
$recipient,
|
||||
mixed $recipient,
|
||||
array $subject,
|
||||
array $bodies,
|
||||
?callable $callback = null,
|
||||
$force = false
|
||||
mixed $force = false
|
||||
) {
|
||||
$fromEmail = $this->routeParameters['from_email'];
|
||||
$fromName = $this->routeParameters['from_name'];
|
||||
|
@@ -17,16 +17,8 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class NotificationHandlerManager
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private iterable $handlers;
|
||||
|
||||
public function __construct(
|
||||
iterable $handlers,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->handlers = $handlers;
|
||||
$this->em = $em;
|
||||
public function __construct(private iterable $handlers, private EntityManagerInterface $em)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,14 +24,8 @@ class NotificationPresence
|
||||
{
|
||||
private array $cache = [];
|
||||
|
||||
private NotificationRepository $notificationRepository;
|
||||
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security, NotificationRepository $notificationRepository)
|
||||
public function __construct(private Security $security, private NotificationRepository $notificationRepository)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->notificationRepository = $notificationRepository;
|
||||
}
|
||||
|
||||
public function countNotificationsForClassAndEntity(string $relatedEntityClass, int $relatedEntityId): array
|
||||
|
@@ -21,17 +21,8 @@ use Twig\Extension\RuntimeExtensionInterface;
|
||||
|
||||
class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private NotificationPresence $notificationPresence;
|
||||
|
||||
private UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(FormFactoryInterface $formFactory, NotificationPresence $notificationPresence, UrlGeneratorInterface $urlGenerator)
|
||||
public function __construct(private FormFactoryInterface $formFactory, private NotificationPresence $notificationPresence, private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
$this->formFactory = $formFactory;
|
||||
$this->notificationPresence = $notificationPresence;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function counterNotificationFor(Environment $environment, string $relatedEntityClass, int $relatedEntityId, array $options = []): string
|
||||
|
Reference in New Issue
Block a user