[CORE][GNUsocial] Fix undefined property typo

This commit is contained in:
Diogo Peralta Cordeiro 2021-07-20 11:37:01 +01:00 committed by Hugo Sales
parent 6cf7693f14
commit 8817613016
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 31 additions and 33 deletions

View File

@ -47,6 +47,7 @@ use App\Core\I18n\I18n;
use App\Core\Queue\Queue; use App\Core\Queue\Queue;
use App\Core\Router\Router; use App\Core\Router\Router;
use App\Util\Common; use App\Util\Common;
use App\Util\Exception\ConfigurationException;
use App\Util\Formatting; use App\Util\Formatting;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use HtmlSanitizer\SanitizerInterface; use HtmlSanitizer\SanitizerInterface;
@ -68,28 +69,29 @@ use Symfony\Component\Security\Core\Security as SSecurity;
use Symfony\Component\Security\Http\Util\TargetPathTrait; use Symfony\Component\Security\Http\Util\TargetPathTrait;
use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment;
class GNUsocial implements EventSubscriberInterface class GNUsocial implements EventSubscriberInterface
{ {
use TargetPathTrait; use TargetPathTrait;
protected bool $initialized = false; protected bool $initialized = false;
protected LoggerInterface $logger; protected LoggerInterface $logger;
protected TranslatorInterface $translator; protected TranslatorInterface $translator;
protected EntityManagerInterface $entity_manager; protected EntityManagerInterface $entity_manager;
protected RouterInterface $router; protected RouterInterface $router;
protected UrlGeneratorInterface $url_generator; protected UrlGeneratorInterface $url_generator;
protected FormFactoryInterface $form_factory; protected FormFactoryInterface $form_factory;
protected MessageBusInterface $message_bus; protected MessageBusInterface $message_bus;
protected EventDispatcherInterface $event_dispatcher; protected EventDispatcherInterface $event_dispatcher;
protected SessionInterface $session; protected SessionInterface $session;
protected SSecurity $security; protected SSecurity $security;
protected ModuleManager $module_manager; protected ModuleManager $module_manager;
protected HttpClientInterface $client; protected HttpClientInterface $client;
protected SanitizerInterface $sanitizer; protected SanitizerInterface $sanitizer;
protected ContainerBagInterface $config; protected ContainerBagInterface $config;
protected \Twig\Environment $twig; protected Environment $twig;
protected ?Request $request; protected ?Request $request;
/** /**
* Symfony dependency injection gives us access to these services * Symfony dependency injection gives us access to these services
@ -108,7 +110,7 @@ class GNUsocial implements EventSubscriberInterface
HttpClientInterface $cl, HttpClientInterface $cl,
SanitizerInterface $san, SanitizerInterface $san,
ContainerBagInterface $conf, ContainerBagInterface $conf,
\Twig\Environment $twig, Environment $twig,
RequestStack $request_stack) RequestStack $request_stack)
{ {
$this->logger = $logger; $this->logger = $logger;
@ -123,7 +125,7 @@ class GNUsocial implements EventSubscriberInterface
$this->security = $sec; $this->security = $sec;
$this->module_manager = $mm; $this->module_manager = $mm;
$this->client = $cl; $this->client = $cl;
$this->saniter = $san; $this->sanitizer = $san;
$this->config = $conf; $this->config = $conf;
$this->twig = $twig; $this->twig = $twig;
$this->request = $request_stack->getCurrentRequest(); $this->request = $request_stack->getCurrentRequest();
@ -134,7 +136,7 @@ class GNUsocial implements EventSubscriberInterface
/** /**
* Store these services to be accessed statically and load modules * Store these services to be accessed statically and load modules
* *
* @param EventDispatcherInterface $event_dispatcher * @throws ConfigurationException
*/ */
public function initialize(): void public function initialize(): void
{ {
@ -149,7 +151,7 @@ class GNUsocial implements EventSubscriberInterface
DB::setManager($this->entity_manager); DB::setManager($this->entity_manager);
Form::setFactory($this->form_factory); Form::setFactory($this->form_factory);
Queue::setMessageBus($this->message_bus); Queue::setMessageBus($this->message_bus);
Security::setHelper($this->security, $this->saniter); Security::setHelper($this->security, $this->sanitizer);
Router::setRouter($this->router, $this->url_generator); Router::setRouter($this->router, $this->url_generator);
HTTPClient::setClient($this->client); HTTPClient::setClient($this->client);
Formatting::setTwig($this->twig); Formatting::setTwig($this->twig);
@ -165,17 +167,14 @@ class GNUsocial implements EventSubscriberInterface
} }
/** /**
* Event very early on in the Symfony HTTP lifecycle, but after everyting is registered * Event very early on in the Symfony HTTP lifecycle, but after everything is registered
* where we get access to the event dispatcher * where we get access to the event dispatcher
* *
* @param RequestEvent $event * @param RequestEvent $event
* @param string $event_name
* @param EventDispatcherInterface $event_dispatcher
* *
* @return RequestEvent * @return RequestEvent
*/ */
public function onKernelRequest(RequestEvent $event, public function onKernelRequest(RequestEvent $event): RequestEvent
string $event_name): RequestEvent
{ {
$this->request = $event->getRequest(); $this->request = $event->getRequest();
@ -191,27 +190,26 @@ class GNUsocial implements EventSubscriberInterface
/** /**
* Event after everything is initialized when using the `bin/console` command * Event after everything is initialized when using the `bin/console` command
* *
* @param ConsoleCommandEvent $event * @param ConsoleCommandEvent $event
* @param string $event_name *
* @param EventDispatcherInterface $event_dispatcher * @throws ConfigurationException
* *
* @return ConsoleCommandEvent * @return ConsoleCommandEvent
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function onCommand(ConsoleCommandEvent $event, public function onCommand(ConsoleCommandEvent $event): ConsoleCommandEvent
string $event_name): ConsoleCommandEvent
{ {
$this->initialize(); $this->initialize();
return $event; return $event;
} }
/** /**
* Tell Symfony which events we want to listen to, which Symfony detects and autowires * Tell Symfony which events we want to listen to, which Symfony detects and auto-wires
* due to this implementing the `EventSubscriberInterface` * due to this implementing the `EventSubscriberInterface`
* *
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public static function getSubscribedEvents() public static function getSubscribedEvents(): array
{ {
return [ return [
KernelEvents::REQUEST => 'onKernelRequest', KernelEvents::REQUEST => 'onKernelRequest',