chore: fix phpstan errors
This commit is contained in:
1 parent
4e925171b3
commit
0fcecc9c58
109 files changed
+510
-429
No files matched your search
@@ -79,6 +79,7 @@ class BulkInsuranceBookingCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Gets the bulk insurance booking flag value from form data or participant DTO.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function getBulkInsuranceBookingValue(array $formData, object $applicant): bool
|
||||
{
|
||||
// First check form data (for fresh submissions)
|
||||
|
||||
@@ -168,6 +168,7 @@ class CompositeCondition implements FieldConditionInterface
|
||||
* Returns false as soon as any condition evaluates to false,
|
||||
* avoiding unnecessary evaluation of remaining conditions.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function evaluateAnd(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
foreach ($this->conditions as $condition) {
|
||||
@@ -185,6 +186,7 @@ class CompositeCondition implements FieldConditionInterface
|
||||
* Returns true as soon as any condition evaluates to true,
|
||||
* avoiding unnecessary evaluation of remaining conditions.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function evaluateOr(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
foreach ($this->conditions as $condition) {
|
||||
@@ -199,6 +201,7 @@ class CompositeCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Evaluates NOT logic by inverting the result of the single condition.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function evaluateNot(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
return !$this->conditions[0]->evaluate($bookingDto, $participantIndex, $formData);
|
||||
@@ -219,6 +222,7 @@ class CompositeCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Validates condition count based on operator requirements.
|
||||
*/
|
||||
/** @param list<mixed> $conditions */
|
||||
private function validateConditionCount(string $operator, array $conditions): void
|
||||
{
|
||||
$conditionCount = count($conditions);
|
||||
|
||||
@@ -175,6 +175,7 @@ class FieldValueCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Retrieves field value from form data or participant data.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function getFieldValue(array $formData, int $participantIndex, BookingDto $bookingDto): mixed
|
||||
{
|
||||
// First check participant-specific form data
|
||||
@@ -212,6 +213,7 @@ class FieldValueCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Checks if field value is in array of expected values.
|
||||
*/
|
||||
/** @param list<mixed> $expectedValues */
|
||||
private function compareIn(mixed $fieldValue, array $expectedValues): bool
|
||||
{
|
||||
foreach ($expectedValues as $expectedValue) {
|
||||
|
||||
@@ -28,10 +28,6 @@ class RentalInsuranceAvailableCondition implements FieldConditionInterface
|
||||
*/
|
||||
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
if (null === $bookingDto->travel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$services = $bookingDto->travel->getAdditionalServicesBySubTypes(
|
||||
Constants::TOKEN_RENTAL_INSURANCE,
|
||||
true
|
||||
|
||||
@@ -49,12 +49,7 @@ class RentalSelectionCondition implements FieldConditionInterface
|
||||
if (null !== $participant) {
|
||||
$rentals = $participant->rentals;
|
||||
if (false === empty($rentals)) {
|
||||
// Check if any rental services are actually selected
|
||||
foreach ($rentals as $rental) {
|
||||
if ($rental instanceof Service) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ use App\Form\Service\Contract\FieldConditionInterface;
|
||||
*/
|
||||
class RoomSelectionCondition implements FieldConditionInterface
|
||||
{
|
||||
private const MATCH_MODE_EXACT = 'exact';
|
||||
private const MATCH_MODE_PREFIX = 'prefix';
|
||||
|
||||
/** @var list<string> */
|
||||
private array $requiredRoomCodes;
|
||||
private string $matchMode;
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ class ServiceSubTypeCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Retrieves service from form data or participant data.
|
||||
*/
|
||||
/** @param array<string, mixed> $formData */
|
||||
private function getService(array $formData, int $participantIndex, BookingDto $bookingDto): ?Service
|
||||
{
|
||||
// First check participant-specific form data
|
||||
@@ -185,6 +186,7 @@ class ServiceSubTypeCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Checks if sub-type is in the expected array.
|
||||
*/
|
||||
/** @param string|list<string> $expectedSubTypes */
|
||||
private function isSubTypeIn(string $actualSubType, string|array $expectedSubTypes): bool
|
||||
{
|
||||
if (is_string($expectedSubTypes)) {
|
||||
@@ -214,6 +216,7 @@ class ServiceSubTypeCondition implements FieldConditionInterface
|
||||
/**
|
||||
* Validates expected sub-type based on operator requirements.
|
||||
*/
|
||||
/** @param string|list<string> $expectedSubType */
|
||||
private function validateExpectedSubType(string $operator, string|array $expectedSubType): void
|
||||
{
|
||||
if (in_array($operator, [self::OPERATOR_IN, self::OPERATOR_NOT_IN], true) && !is_array($expectedSubType)) {
|
||||
|
||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Service\Condition;
|
||||
|
||||
use App\BusProNet\Model\Service;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Contract\FieldConditionInterface;
|
||||
|
||||
@@ -39,7 +38,7 @@ class SkiPassSelectionCondition implements FieldConditionInterface
|
||||
// First check submitted form data for skipass selection
|
||||
if (isset($formData['participants'][$participantIndex]['skiPass'])) {
|
||||
$selectedSkiPass = $formData['participants'][$participantIndex]['skiPass'];
|
||||
if (null !== $selectedSkiPass && '' !== $selectedSkiPass) {
|
||||
if ('' !== $selectedSkiPass) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -47,10 +46,7 @@ class SkiPassSelectionCondition implements FieldConditionInterface
|
||||
// Then check participant DTO data for existing skipass selection
|
||||
$participant = $bookingDto->getParticipant($participantIndex);
|
||||
if (null !== $participant && null !== $participant->skiPass) {
|
||||
// Check if skipass is actually a Service object
|
||||
if ($participant->skiPass instanceof Service) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user