chore: cgl cleanup

This commit is contained in:
Björn Fromme
2026-04-16 13:34:54 +02:00
parent c0cc183c59
commit a927d6bf59
26 changed files with 45 additions and 66 deletions
+1
View File
@@ -193,6 +193,7 @@ class BpnXmlSyncCommand extends Command
/**
* @return array<string, int>
*
* @throws FilesystemException
*/
private function syncFiles(SymfonyStyle $io): array
@@ -14,9 +14,9 @@ use App\Form\PersonalDataType;
use App\Repository\NewsletterOptInConfirmationRepository;
use App\Security\Crypt;
use App\Service\BookingEditDataLoader;
use App\Service\ProfileCompletenessChecker;
use App\Service\MailjetApiClient;
use App\Service\NewsletterManager;
use App\Service\ProfileCompletenessChecker;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -37,12 +37,12 @@ class PersonalDataController extends AbstractController
public const SESSION_REDIRECT_KEY = '_profile_completion_redirect';
/**
* @param ApiClient $apiClient BusProNet API client for data operations
* @param Crypt $crypt Encryption service for password handling
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
* @param LoggerInterface $logger Logger for audit trails and debugging
* @param ApiClient $apiClient BusProNet API client for data operations
* @param Crypt $crypt Encryption service for password handling
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
* @param LoggerInterface $logger Logger for audit trails and debugging
*/
public function __construct(
private readonly ApiClient $apiClient,
@@ -182,8 +182,7 @@ class Step4Controller extends AbstractController
FormInterface $form,
bool $newsletterOptInVisible,
?string $newsletterTargetEmail,
): Response
{
): Response {
$bookingCreateContext = $this->createContextFactory->createWithParticipantPrices($bookingCreateDto);
return $this->render('booking/create/step_4.html.twig', [
+1
View File
@@ -86,6 +86,7 @@ class Mailer
/**
* @param array<string, mixed> $options
*
* @return array<string, mixed>
*/
private function resolveConfig(array $options): array
+3 -3
View File
@@ -10,10 +10,10 @@ namespace App\Form\Model;
final class BookingSummaryPricingDto
{
/**
* @param array<int, array<string, mixed>> $rooms
* @param array<int, array<string, mixed>> $services
* @param array<int, array<string, mixed>> $rooms
* @param array<int, array<string, mixed>> $services
* @param array<int, array<string, mixed>>|null $surcharges
* @param array<int, int> $assignmentCounts
* @param array<int, int> $assignmentCounts
*/
public function __construct(
public readonly array $rooms,
+1 -1
View File
@@ -22,8 +22,8 @@ use App\Form\Service\Condition\RentalSelectionCondition;
use App\Form\Service\Condition\RoomSelectionCondition;
use App\Form\Service\Condition\ServiceSubTypeCondition;
use App\Form\Service\Condition\SkiPassSelectionCondition;
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
use App\Form\Service\Condition\TransportationServicesMutabilityCondition;
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
/**
* Field state provider for the booking edit workflow.
@@ -16,8 +16,8 @@ use App\Form\Model\RoomSelectionDto;
use App\Form\Service\Abstract\AbstractFieldOptionsProvider;
use App\Service\BookingPriceCalculator;
use App\Service\InsuranceManager;
use App\Service\ServiceLabelFormatter;
use App\Service\ServiceAvailabilityCalculator;
use App\Service\ServiceLabelFormatter;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
@@ -222,8 +222,8 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
* - rental.dateFrom === skipass.dateFrom
* - rental.dateTo === skipass.dateTo
*
* @param array $rentals All available rental services
* @param \App\Form\Model\ParticipantDto $participant The participant with skipass selection
* @param array $rentals All available rental services
* @param ParticipantDto $participant The participant with skipass selection
*
* @return array Filtered rentals matching the skipass duration
*/
+2 -4
View File
@@ -13,8 +13,8 @@ use App\BusProNet\XmlLoader\AgencyLoader;
use App\Exception\NoRoomsAvailableException;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Form\Service\ServiceAgeEvaluator;
use App\Form\Model\RoomSelectionDto;
use App\Form\Service\ServiceAgeEvaluator;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -539,8 +539,7 @@ class BookingConfigurator
BookingDto $bookingDto,
int $participantIndex,
ServiceAgeEvaluator $ageEvaluator,
): bool
{
): bool {
if (false === $ageEvaluator->canEvaluate($service)) {
return true;
}
@@ -640,5 +639,4 @@ class BookingConfigurator
$bookingDto->bookingStatus = $this->bookingStatusRuleRegistry->evaluateStatus($bookingDto);
}
}
+1 -2
View File
@@ -25,8 +25,7 @@ class BookingCreateContextFactory
public function create(
BookingDto $bookingDto,
string $pricingMode = RoomPricingCalculator::PRICING_MODE_ASSIGNMENT,
): BookingCreateContext
{
): BookingCreateContext {
$baseContext = $this->buildBaseContext($bookingDto, $pricingMode);
return new BookingCreateContext(
+1 -1
View File
@@ -7,8 +7,8 @@ namespace App\Service;
use App\BusProNet\Model\Booking;
use App\Form\Model\BookingDto;
use App\Form\Model\BookingEditContext;
use App\Form\Model\BookingSummaryDto;
use App\Form\Model\BookingMutabilityDto;
use App\Form\Model\BookingSummaryDto;
/**
* Prepares the shared booking edit flow context.
+1 -1
View File
@@ -88,7 +88,7 @@ class BookingEditDataLoader
// Refresh availability and mutability data to ensure current state.
// Availability is refreshed on every load; mutability is patched from cache.
$this->travelDataService->enrichWithFreshAvailabilities($formData->travel);
$bookingData = $this->fetchBookingData($bookingId, $user);
if (null !== $bookingData && !($bookingData instanceof Notification)) {
$mutableData = $this->travelDataService->getMutabilityData($bookingData->dateId, cached: true);
+2
View File
@@ -241,6 +241,7 @@ class BookingPricingAssembler
* Groups services by their subtypes for display, separating positive costs and discounts.
*
* @param array<string, array<string, mixed>> $serviceAggregation
*
* @return array<int, array<string, mixed>>
*/
private function groupServicesBySubtype(array $serviceAggregation): array
@@ -387,6 +388,7 @@ class BookingPricingAssembler
/**
* @param array<string, mixed> $serviceData
*
* @return array<string, mixed>
*/
private function createServicePricingLineItem(array $serviceData): array
+1 -2
View File
@@ -42,8 +42,7 @@ class BookingSummaryAssembler
public function getSummaryData(
BookingDto $bookingDto,
string $roomPricingMode = RoomPricingCalculator::PRICING_MODE_ASSIGNMENT,
): BookingSummaryDto
{
): BookingSummaryDto {
// Get selected rooms (for Step1 controller compatibility)
$selectedRooms = $bookingDto->getSelectedRooms();
-2
View File
@@ -161,8 +161,6 @@ class BpnXmlAnonymizer
}
/**
* @param string $personId
*
* @return array{firstName: string, lastName: string, street: string, postalCode: string, city: string, email: string, mobilePhone: string}
*/
private function getOrCreateIdentity(string $personId): array
+5 -14
View File
@@ -157,19 +157,13 @@ class MailjetApiClient
$payload = $response->toArray(false);
if ($statusCode >= 400) {
$payloadSummary = is_array($payload)
? json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
: null;
$payloadSummary = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$payloadSummary = false === $payloadSummary ? null : $payloadSummary;
throw new NewsletterProviderException(sprintf(
'Mailjet request failed with status %d for resource %s%s',
$statusCode,
$resource,
null !== $payloadSummary ? sprintf(' (%s)', $payloadSummary) : ''
));
throw new NewsletterProviderException(sprintf('Mailjet request failed with status %d for resource %s%s', $statusCode, $resource, null !== $payloadSummary ? sprintf(' (%s)', $payloadSummary) : ''));
}
return is_array($payload) ? $payload : [];
return $payload;
} catch (\Throwable $exception) {
if ($allow404 && str_contains($exception->getMessage(), '404')) {
return [];
@@ -179,10 +173,7 @@ class MailjetApiClient
throw $exception;
}
throw new NewsletterProviderException(
sprintf('Mailjet request error for resource %s', $resource),
previous: $exception
);
throw new NewsletterProviderException(sprintf('Mailjet request error for resource %s', $resource), previous: $exception);
}
}
+1 -1
View File
@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Service;
use App\Email\Mailer;
use App\Exception\NewsletterProviderException;
use App\Entity\NewsletterOptInConfirmation;
use App\Exception\NewsletterProviderException;
use App\Model\NewsletterConfirmationResult;
use App\Repository\NewsletterOptInConfirmationRepository;
use Doctrine\ORM\EntityManagerInterface;
-6
View File
@@ -26,8 +26,6 @@ class ParticipantCardAssembler
/**
* Get card data for a single participant.
*
* @return ParticipantCardDataDto
*/
public function getCardData(BookingDto $bookingDto, int $index): ParticipantCardDataDto
{
@@ -124,8 +122,6 @@ class ParticipantCardAssembler
*
* Returns a dash marker when the price is zero and no room is assigned,
* indicating incomplete configuration rather than a zero-cost booking.
*
* @return ParticipantCardPriceDto
*/
private function getPriceData(BookingDto $bookingDto, int $index): ParticipantCardPriceDto
{
@@ -169,8 +165,6 @@ class ParticipantCardAssembler
/**
* Get card data for a single participant with validation state.
*
* @return ParticipantCardDataDto
*/
public function getCardDataWithValidation(BookingDto $bookingDto, int $index): ParticipantCardDataDto
{
+2 -4
View File
@@ -28,8 +28,7 @@ class RoomPricingCalculator
public function calculateRoomPricing(
BookingDto $bookingDto,
string $pricingMode = self::PRICING_MODE_ASSIGNMENT,
): array
{
): array {
// In edit mode, use room data from the booking entity
if (BookingDto::MODE_EDIT === $bookingDto->getMode() && null !== $bookingDto->booking) {
return $this->calculateRoomPricingFromBooking($bookingDto);
@@ -45,8 +44,7 @@ class RoomPricingCalculator
public function calculateRoomTotal(
BookingDto $bookingDto,
string $pricingMode = self::PRICING_MODE_ASSIGNMENT,
): float
{
): float {
$roomPricing = $this->calculateRoomPricing($bookingDto, $pricingMode);
return array_sum(array_column($roomPricing, 'totalPrice'));
+1 -1
View File
@@ -40,7 +40,7 @@ final class ServiceLabelFormatter
return $fallbackLabel;
}
if (!($service instanceof Service)) {
if (!$service instanceof Service) {
return $fallbackLabel;
}
+3 -3
View File
@@ -85,9 +85,9 @@ class TravelDataProvider
*
* @return Travel|null The travel data or null on unexpected failure
*
* @throws TravelNotFoundException When the travel date is not found
* @throws HotelNotFoundException When the requested hotel is not found
* @throws HotelNotInTravelException When the hotel does not belong to this travel
* @throws TravelNotFoundException When the travel date is not found
* @throws HotelNotFoundException When the requested hotel is not found
* @throws HotelNotInTravelException When the hotel does not belong to this travel
*/
public function getTravelDataFromXml(int $dateId, ?int $hotelId = null): ?Travel
{
+3 -1
View File
@@ -162,14 +162,16 @@ class TravelSnapshotManager
/**
* Refreshes snapshot payloads with extended availability data.
*
* @param array<int>|null $xmlAvailableDateIds
*
* @return array{processed:int,updated:int,failed:int}
*/
public function refreshExtendedSnapshots(
int $limit = 500,
bool $force = false,
int $refreshAfterMinutes = 360,
?array $xmlAvailableDateIds = null
?array $xmlAvailableDateIds = null,
): array {
$dateToThreshold = new \DateTimeImmutable('today');
$refreshBefore = new \DateTimeImmutable(sprintf('-%d minutes', $refreshAfterMinutes));
-1
View File
@@ -14,7 +14,6 @@ use App\Model\DomainConfig;
use App\Service\ParticipantEligibilityChecker;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\RequestStack;
use Twig\Environment;
use Twig\Extension\RuntimeExtensionInterface;
use Twig\Extra\Intl\IntlExtension;
@@ -22,4 +22,3 @@ class MandatoryAdditionalServicesSelected extends Constraint
return static::CLASS_CONSTRAINT;
}
}
@@ -83,4 +83,3 @@ class MandatoryAdditionalServicesSelectedValidator extends ConstraintValidator
}
}
}