Fix #602: Add DateTime
rule
#4268
Annotations
1 error and 4 warnings
mutation / PHP 8.1-ubuntu-latest
Process completed with exit code 1.
|
mutation / PHP 8.1-ubuntu-latest:
src/Rule/DateTimeHandler.php#L36
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
}
\DateTime::createFromFormat($rule->getFormat(), (string) $value);
// Before PHP 8.2 may return array instead of false (see https://github.com/php/php-src/issues/9431).
- $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => 0];
+ $errors = \DateTime::getLastErrors() ?: ['error_count' => -1, 'warning_count' => 0];
if ($errors['error_count'] !== 0 || $errors['warning_count'] !== 0) {
$result->addError($rule->getMessage(), ['attribute' => $context->getTranslatedAttribute(), 'value' => $value]);
}
|
mutation / PHP 8.1-ubuntu-latest:
src/Rule/DateTimeHandler.php#L36
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
}
\DateTime::createFromFormat($rule->getFormat(), (string) $value);
// Before PHP 8.2 may return array instead of false (see https://github.com/php/php-src/issues/9431).
- $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => 0];
+ $errors = \DateTime::getLastErrors() ?: ['error_count' => 1, 'warning_count' => 0];
if ($errors['error_count'] !== 0 || $errors['warning_count'] !== 0) {
$result->addError($rule->getMessage(), ['attribute' => $context->getTranslatedAttribute(), 'value' => $value]);
}
|
mutation / PHP 8.1-ubuntu-latest:
src/Rule/DateTimeHandler.php#L36
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
}
\DateTime::createFromFormat($rule->getFormat(), (string) $value);
// Before PHP 8.2 may return array instead of false (see https://github.com/php/php-src/issues/9431).
- $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => 0];
+ $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => -1];
if ($errors['error_count'] !== 0 || $errors['warning_count'] !== 0) {
$result->addError($rule->getMessage(), ['attribute' => $context->getTranslatedAttribute(), 'value' => $value]);
}
|
mutation / PHP 8.1-ubuntu-latest:
src/Rule/DateTimeHandler.php#L36
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
}
\DateTime::createFromFormat($rule->getFormat(), (string) $value);
// Before PHP 8.2 may return array instead of false (see https://github.com/php/php-src/issues/9431).
- $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => 0];
+ $errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warning_count' => 1];
if ($errors['error_count'] !== 0 || $errors['warning_count'] !== 0) {
$result->addError($rule->getMessage(), ['attribute' => $context->getTranslatedAttribute(), 'value' => $value]);
}
|