Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CronExpressionType for Codecov #54

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/Doctrine/DBAL/Types/CronExpressionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
}

if (!is_string($value)) {
if (class_exists(InvalidType::class)) {
throw InvalidType::new($value, CronExpression::class, ['string']);
}

/**
* @psalm-suppress UndefinedMethod
*/
throw ConversionException::conversionFailedInvalidType($value, CronExpression::class, ['string']);
throw class_exists(InvalidType::class) ? InvalidType::new($value, CronExpression::class, ['string']) : ConversionException::conversionFailedInvalidType($value, CronExpression::class, ['string']);
}

if ('' === $value) {
Expand All @@ -49,14 +45,10 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
try {
return CronExpression::factory($value);
} catch (\Throwable $e) {
if (class_exists(ValueNotConvertible::class)) {
throw ValueNotConvertible::new($value, CronExpression::class, null, $e);
}

/**
* @psalm-suppress UndefinedMethod
*/
throw ConversionException::conversionFailed($value, CronExpression::class, $e);
throw class_exists(ValueNotConvertible::class) ? ValueNotConvertible::new($value, CronExpression::class, null, $e) : ConversionException::conversionFailed($value, CronExpression::class, $e);
}
}

Expand Down