chore: fix phpstan errors
This commit is contained in:
@@ -19,6 +19,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/** @extends AbstractCrudController<BookingEditDraft> */
|
||||
class BookingEditDraftCrudController extends AbstractCrudController
|
||||
{
|
||||
public function __construct(
|
||||
|
||||
@@ -18,6 +18,7 @@ use League\Flysystem\FilesystemException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/** @extends AbstractCrudController<LogEntry> */
|
||||
class LogEntryCrudController extends AbstractCrudController
|
||||
{
|
||||
public function __construct(
|
||||
|
||||
@@ -10,6 +10,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
/** @extends AbstractCrudController<User> */
|
||||
class UserCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
|
||||
@@ -8,6 +8,7 @@ use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\FilesystemOperator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Exception\JsonException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -73,7 +74,7 @@ class PickupController extends AbstractController
|
||||
{
|
||||
try {
|
||||
$payload = $request->toArray();
|
||||
} catch (\JsonException $e) {
|
||||
} catch (JsonException $e) {
|
||||
$this->logger->error('Failed to update pickups planning data', [
|
||||
'message' => $e->getMessage(),
|
||||
'payload' => (string) $request->getContent(),
|
||||
|
||||
@@ -58,7 +58,7 @@ class TravelController extends AbstractController
|
||||
name: 'api_travel_single_code',
|
||||
defaults: ['hotelCode' => null],
|
||||
)]
|
||||
public function byCode(Request $request, $dateCode, ?string $hotelCode = null): JsonResponse
|
||||
public function byCode(Request $request, string $dateCode, ?string $hotelCode = null): JsonResponse
|
||||
{
|
||||
// sanitize date code by removing potential dividers
|
||||
$dateCode = (new DateCodeUtility())->sanitize($dateCode);
|
||||
|
||||
@@ -66,6 +66,11 @@ class UserinfoController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $scopes
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function getClaims(PersonalData $data, array $scopes): array
|
||||
{
|
||||
// get all available claims
|
||||
|
||||
@@ -132,6 +132,7 @@ class Step2Controller extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/** @param array<int, \App\Form\Model\RoomSelectionDto> $roomSelections */
|
||||
private function calculateParticipantsCount(array $roomSelections, Travel $travelData): int
|
||||
{
|
||||
$participantsCount = 0;
|
||||
|
||||
@@ -124,6 +124,7 @@ class Step2ParticipantController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/** @param FormInterface<mixed> $form */
|
||||
private function renderParticipantForm(
|
||||
FormInterface $form,
|
||||
int $index,
|
||||
@@ -157,6 +158,7 @@ class Step2ParticipantController extends AbstractController
|
||||
return $bookingDto;
|
||||
}
|
||||
|
||||
/** @return FormInterface<mixed> */
|
||||
private function createParticipantForm(BookingDto $bookingDto, int $index): FormInterface
|
||||
{
|
||||
$wrapper = $this->participantFormSupportService->createParticipantEditDto($bookingDto, $index);
|
||||
|
||||
@@ -220,6 +220,7 @@ class Step3Controller extends AbstractController
|
||||
/**
|
||||
* Renders the step 3 form with standard template variables.
|
||||
*/
|
||||
/** @param FormInterface<mixed> $form */
|
||||
private function renderStepForm(BookingDto $bookingCreateDto, FormInterface $form): Response
|
||||
{
|
||||
$context = $this->createContextFactory->create(
|
||||
|
||||
@@ -177,6 +177,9 @@ class Step4Controller extends AbstractController
|
||||
/**
|
||||
* Renders the step 4 form with standard template variables.
|
||||
*/
|
||||
/**
|
||||
* @param FormInterface<mixed> $form
|
||||
*/
|
||||
private function renderStepForm(
|
||||
BookingDto $bookingCreateDto,
|
||||
FormInterface $form,
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Service\BookingSessionManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\FlashBagAwareSessionInterface;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/**
|
||||
@@ -23,11 +24,17 @@ class SuccessController extends AbstractController
|
||||
#[Route('/bookings/create/success', name: 'app_booking_create_success')]
|
||||
public function success(Request $request): Response
|
||||
{
|
||||
$flashBag = $request->getSession()->getFlashBag();
|
||||
$returnUrl = $this->bookingSessionService->getReturnUrl($request);
|
||||
$session = $request->getSession();
|
||||
|
||||
if (!$session instanceof FlashBagAwareSessionInterface) {
|
||||
return $this->redirect($returnUrl);
|
||||
}
|
||||
|
||||
$flashBag = $session->getFlashBag();
|
||||
$bookingNumber = $flashBag->get('booking_number')[0] ?? null;
|
||||
$bookingTotal = $flashBag->get('booking_total')[0] ?? null;
|
||||
$travelName = $flashBag->get('booking_travel_name')[0] ?? null;
|
||||
$returnUrl = $this->bookingSessionService->getReturnUrl($request);
|
||||
|
||||
// Redirect to return URL if no booking number (direct access or refresh)
|
||||
if (null === $bookingNumber) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class DownloadController extends AbstractController
|
||||
$type = match ($fileType) {
|
||||
'documents' => 'Dokumentdruck',
|
||||
'invoice' => 'Vorgangdruck',
|
||||
default => throw new \InvalidArgumentException(sprintf('Unknown file type: %s', $fileType)),
|
||||
};
|
||||
|
||||
$this->logger->info('Initiated document download', [
|
||||
|
||||
@@ -52,6 +52,9 @@ trait BookingCreateTrait
|
||||
/**
|
||||
* Handles API errors by logging and adding a flash message.
|
||||
*/
|
||||
/**
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
private function handleApiError(
|
||||
LoggerInterface $logger,
|
||||
string $logMessage,
|
||||
|
||||
@@ -5,9 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Controller\Booking\Traits;
|
||||
|
||||
use App\Exception\BookingSessionNotFoundException;
|
||||
use App\Exception\HotelNotFoundException;
|
||||
use App\Exception\HotelNotInTravelException;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Exception\TravelNotFoundException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Service\BookingSessionManager;
|
||||
@@ -33,25 +31,9 @@ trait BookingExceptionHandlerTrait
|
||||
{
|
||||
try {
|
||||
return $bookingSessionService->getOrCreateBookingCreateDto($request);
|
||||
} catch (BookingSessionNotFoundException $e) {
|
||||
} catch (BookingSessionNotFoundException|TravelNotFoundException|HotelNotInTravelException $e) {
|
||||
$this->addFlash('error', 'Deine Buchungssitzung ist abgelaufen. Bitte starte eine neue Buchung.');
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_error');
|
||||
} catch (TravelNotFoundException $e) {
|
||||
$this->addFlash('error', 'Die angeforderte Reise wurde nicht gefunden.');
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_error');
|
||||
} catch (HotelNotFoundException $e) {
|
||||
$this->addFlash('error', 'Das angeforderte Hotel wurde nicht gefunden.');
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_error');
|
||||
} catch (HotelNotInTravelException $e) {
|
||||
$this->addFlash('error', 'Das Hotel ist für diese Reise nicht verfügbar.');
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_error');
|
||||
} catch (NoRoomsAvailableException $e) {
|
||||
$this->addFlash('error', 'Für diese Reise sind aktuell keine Zimmer verfügbar.');
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_error');
|
||||
}
|
||||
}
|
||||
@@ -66,7 +48,7 @@ trait BookingExceptionHandlerTrait
|
||||
{
|
||||
try {
|
||||
return $bookingSessionService->getOrCreateBookingCreateDto($request);
|
||||
} catch (BookingSessionNotFoundException|TravelNotFoundException|HotelNotFoundException|HotelNotInTravelException|NoRoomsAvailableException $e) {
|
||||
} catch (BookingSessionNotFoundException|TravelNotFoundException|HotelNotInTravelException $e) {
|
||||
return new Response('', 400);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user