chore: major code cleanup and type safety using phpstan

This commit is contained in:
Björn Fromme committed 2026-04-16 17:11:16 +02:00
1 parent 060cbea9da
commit 3da73d626b
103 files changed
+976 -1192

No files matched your search

+4 -4
View File
@@ -51,7 +51,7 @@ class BpnXmlAnonymizer
continue;
}
$personId = $this->resolvePersonId($personNode, (int) $index);
$personId = $this->resolvePersonId($personNode, $index);
$identity = $this->getOrCreateIdentity($personId);
$this->replaceNameFields($personNode, $identity);
@@ -96,7 +96,7 @@ class BpnXmlAnonymizer
}
if (true === $personNode->hasAttribute('id')) {
$attributeValue = trim((string) $personNode->getAttribute('id'));
$attributeValue = trim($personNode->getAttribute('id'));
if ('' !== $attributeValue) {
return sprintf('attr-id:%s', $attributeValue);
}
@@ -115,7 +115,7 @@ class BpnXmlAnonymizer
$nameValues[] = trim($nameNode->textContent);
}
if (true === $personNode->hasAttribute('name')) {
$nameValues[] = trim((string) $personNode->getAttribute('name'));
$nameValues[] = trim($personNode->getAttribute('name'));
}
$firstNameNode = $this->getDirectChild($personNode, 'vorname');
@@ -123,7 +123,7 @@ class BpnXmlAnonymizer
$nameValues[] = trim($firstNameNode->textContent);
}
if (true === $personNode->hasAttribute('vorname')) {
$nameValues[] = trim((string) $personNode->getAttribute('vorname'));
$nameValues[] = trim($personNode->getAttribute('vorname'));
}
$communicationNode = $this->getDirectChild($personNode, 'kommunikation');
+2 -2
View File
@@ -136,7 +136,7 @@ class InsuranceManager
$eligibleInsurances = $this->getEligibleInsurances($sameTypeInsurances, $participant, $booking, $travelPrice);
// Return the first eligible insurance (they should all be equivalent for the same type)
return !empty($eligibleInsurances) ? array_values($eligibleInsurances)[0] : null;
return [] !== $eligibleInsurances ? array_values($eligibleInsurances)[0] : null;
}
/**
@@ -168,7 +168,7 @@ class InsuranceManager
foreach ($booking->getParticipants() as $index => $participant) {
$travelPrice = $participantPrices[$index] ?? 0.0;
$eligibleInsurances = $this->getEligibleInsurances($sameTypeInsurances, $participant, $booking, $travelPrice);
$assignments[$index] = !empty($eligibleInsurances) ? array_values($eligibleInsurances)[0] : null;
$assignments[$index] = [] !== $eligibleInsurances ? array_values($eligibleInsurances)[0] : null;
}
return $assignments;
@@ -70,7 +70,7 @@ class ParticipantEligibilityChecker
fn (Service $service) => $this->isSkiPassAvailableForParticipant($service, $bookingDto, $participantIndex)
);
return !empty($availableSkiPasses);
return [] !== $availableSkiPasses;
})();
}