Applied rector with PHP8.1 migration rules

This commit is contained in:
Jan Böhmer 2023-06-11 14:15:46 +02:00
parent dc6a67c2f0
commit 7ee01d9a05
303 changed files with 1228 additions and 3465 deletions

View file

@ -37,17 +37,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
final class LoginSuccessSubscriber implements EventSubscriberInterface
{
private TranslatorInterface $translator;
private RequestStack $requestStack;
private EventLogger $eventLogger;
private bool $gpdr_compliance;
public function __construct(TranslatorInterface $translator, RequestStack $requestStack, EventLogger $eventLogger, bool $gpdr_compliance)
public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliance)
{
$this->translator = $translator;
$this->requestStack = $requestStack;
$this->eventLogger = $eventLogger;
$this->gpdr_compliance = $gpdr_compliance;
}
public function onLogin(InteractiveLoginEvent $event): void

View file

@ -36,14 +36,8 @@ use Symfony\Component\Security\Core\Security;
*/
final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
{
private \Symfony\Bundle\SecurityBundle\Security $security;
private UrlGeneratorInterface $urlGenerator;
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator)
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator)
{
$this->security = $security;
$this->urlGenerator = $urlGenerator;
}
public function onRequest(RequestEvent $event): void

View file

@ -55,13 +55,9 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
* @var string The route the user will redirected to, if he needs to change this password
*/
public const REDIRECT_TARGET = 'user_settings';
private \Symfony\Bundle\SecurityBundle\Security $security;
private HttpUtils $httpUtils;
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, HttpUtils $httpUtils)
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly HttpUtils $httpUtils)
{
$this->security = $security;
$this->httpUtils = $httpUtils;
}
/**
@ -129,7 +125,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
{
$tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled();
return null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
return $user->getGroup() instanceof \App\Entity\UserSystem\Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
}
public static function getSubscribedEvents(): array

View file

@ -33,13 +33,8 @@ use Symfony\Component\Security\Core\Security;
*/
final class SetUserTimezoneSubscriber implements EventSubscriberInterface
{
private string $default_timezone;
private \Symfony\Bundle\SecurityBundle\Security $security;
public function __construct(string $timezone, \Symfony\Bundle\SecurityBundle\Security $security)
public function __construct(private readonly string $default_timezone, private readonly \Symfony\Bundle\SecurityBundle\Security $security)
{
$this->default_timezone = $timezone;
$this->security = $security;
}
public function setTimeZone(ControllerEvent $event): void

View file

@ -35,17 +35,8 @@ use Symfony\Component\Security\Core\Security;
*/
class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
{
private \Symfony\Bundle\SecurityBundle\Security $security;
private PermissionSchemaUpdater $permissionSchemaUpdater;
private EntityManagerInterface $entityManager;
private EventCommentHelper $eventCommentHelper;
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper)
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper)
{
$this->security = $security;
$this->permissionSchemaUpdater = $permissionSchemaUpdater;
$this->entityManager = $entityManager;
$this->eventCommentHelper = $eventCommentHelper;
}
public function onRequest(RequestEvent $event): void
@ -55,7 +46,7 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
}
$user = $this->security->getUser();
if (null === $user) {
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
//Retrieve anonymous user
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
}