protected static function AbstractComparisonValidatorTestCase::addPhp5Dot5Comparisons in Plug 7
2 calls to AbstractComparisonValidatorTestCase::addPhp5Dot5Comparisons()
- AbstractComparisonValidatorTestCase::provideAllInvalidComparisons in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ AbstractComparisonValidatorTestCase.php - AbstractComparisonValidatorTestCase::provideAllValidComparisons in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ AbstractComparisonValidatorTestCase.php
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ AbstractComparisonValidatorTestCase.php, line 37
Class
- AbstractComparisonValidatorTestCase
- @author Daniel Holmes <daniel@danielholmes.org>
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
protected static function addPhp5Dot5Comparisons(array $comparisons) {
if (version_compare(PHP_VERSION, '5.5.0-dev', '<')) {
return $comparisons;
}
$result = $comparisons;
// Duplicate all tests involving DateTime objects to be tested with
// DateTimeImmutable objects as well
foreach ($comparisons as $comparison) {
$add = false;
foreach ($comparison as $i => $value) {
if ($value instanceof \DateTime) {
$comparison[$i] = new \DateTimeImmutable($value
->format('Y-m-d H:i:s.u e'), $value
->getTimezone());
$add = true;
}
elseif ('DateTime' === $value) {
$comparison[$i] = 'DateTimeImmutable';
$add = true;
}
}
if ($add) {
$result[] = $comparison;
}
}
return $result;
}