Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/validator/Constraints/AbstractComparisonValidator.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
53 } | 53 } |
54 | 54 |
55 try { | 55 try { |
56 $comparedValue = $this->getPropertyAccessor()->getValue($object, $path); | 56 $comparedValue = $this->getPropertyAccessor()->getValue($object, $path); |
57 } catch (NoSuchPropertyException $e) { | 57 } catch (NoSuchPropertyException $e) { |
58 throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, get_class($constraint), $e->getMessage()), 0, $e); | 58 throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, \get_class($constraint), $e->getMessage()), 0, $e); |
59 } | 59 } |
60 } else { | 60 } else { |
61 $comparedValue = $constraint->value; | 61 $comparedValue = $constraint->value; |
62 } | 62 } |
63 | 63 |
64 // Convert strings to DateTimes if comparing another DateTime | 64 // Convert strings to DateTimes if comparing another DateTime |
65 // This allows to compare with any date/time value supported by | 65 // This allows to compare with any date/time value supported by |
66 // the DateTime constructor: | 66 // the DateTime constructor: |
67 // http://php.net/manual/en/datetime.formats.php | 67 // http://php.net/manual/en/datetime.formats.php |
68 if (is_string($comparedValue)) { | 68 if (\is_string($comparedValue)) { |
69 if ($value instanceof \DateTimeImmutable) { | 69 if ($value instanceof \DateTimeImmutable) { |
70 // If $value is immutable, convert the compared value to a | 70 // If $value is immutable, convert the compared value to a |
71 // DateTimeImmutable too | 71 // DateTimeImmutable too |
72 $comparedValue = new \DateTimeImmutable($comparedValue); | 72 $comparedValue = new \DateTimeImmutable($comparedValue); |
73 } elseif ($value instanceof \DateTimeInterface) { | 73 } elseif ($value instanceof \DateTimeInterface) { |