Skip to content

Commit

Permalink
Fix CS / PHPSTAN
Browse files Browse the repository at this point in the history
  • Loading branch information
damienalexandre committed Jul 12, 2024
1 parent 5ed5b40 commit 6622d71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ parameters:
message: "#^Method JoliCode\\\\Elastically\\\\Index\\:\\:getClient\\(\\) should return JoliCode\\\\Elastically\\\\Client but returns Elastica\\\\Client\\.$#"
count: 1
path: src/Index.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ResponseEvent\\:\\:isMasterRequest\\(\\)\\.$#"
count: 1
path: src/Messenger/IndexationRequestSpoolSubscriber.php
3 changes: 2 additions & 1 deletion src/Messenger/IndexationRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public function __construct(Client $client, MessageBusInterface $bus, DocumentEx
/**
* @throws ExceptionInterface
* @throws UnrecoverableMessageHandlingException
* @throws \Symfony\Component\Messenger\Exception\ExceptionInterface
*/
public function __invoke(IndexationRequestInterface $message)
public function __invoke(IndexationRequestInterface $message): void
{
$messages = [];
if ($message instanceof MultipleIndexationRequest) {
Expand Down
16 changes: 7 additions & 9 deletions src/Messenger/IndexationRequestSpoolSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\Exception\TransportException;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Transport\TransportInterface;
Expand All @@ -35,15 +36,16 @@ public function __construct(TransportInterface $singleTransport, MessageBusInter
$this->bus = $bus;
}

public function onException()
public function onException(): void
{
$this->wasExceptionThrown = true;
}

/**
* @throws TransportException
* @throws ExceptionInterface
*/
public function onTerminate()
public function onTerminate(): void
{
if ($this->wasExceptionThrown) {
return;
Expand All @@ -66,15 +68,11 @@ public function onTerminate()
}

/**
* @throws TransportException
* @throws TransportException|ExceptionInterface
*/
public function onResponse(ResponseEvent $event)
public function onResponse(ResponseEvent $event): void
{
if (method_exists($event, 'isMainRequest')) {
if (!$event->isMainRequest()) {
return;
}
} elseif (!$event->isMasterRequest()) {
if (!$event->isMainRequest()) {
return;
}

Expand Down

0 comments on commit 6622d71

Please sign in to comment.