diff vendor/symfony/validator/Constraints/Composite.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/Composite.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/validator/Constraints/Composite.php	Thu Feb 28 13:21:36 2019 +0000
@@ -61,26 +61,26 @@
         $compositeOption = $this->getCompositeOption();
         $nestedConstraints = $this->$compositeOption;
 
-        if (!is_array($nestedConstraints)) {
-            $nestedConstraints = array($nestedConstraints);
+        if (!\is_array($nestedConstraints)) {
+            $nestedConstraints = [$nestedConstraints];
         }
 
         foreach ($nestedConstraints as $constraint) {
             if (!$constraint instanceof Constraint) {
-                if (is_object($constraint)) {
-                    $constraint = get_class($constraint);
+                if (\is_object($constraint)) {
+                    $constraint = \get_class($constraint);
                 }
 
-                throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, get_class($this)));
+                throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, \get_class($this)));
             }
 
             if ($constraint instanceof Valid) {
-                throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', get_class($this)));
+                throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', \get_class($this)));
             }
         }
 
         if (!property_exists($this, 'groups')) {
-            $mergedGroups = array();
+            $mergedGroups = [];
 
             foreach ($nestedConstraints as $constraint) {
                 foreach ($constraint->groups as $group) {
@@ -98,14 +98,8 @@
             if (property_exists($constraint, 'groups')) {
                 $excessGroups = array_diff($constraint->groups, $this->groups);
 
-                if (count($excessGroups) > 0) {
-                    throw new ConstraintDefinitionException(sprintf(
-                        'The group(s) "%s" passed to the constraint %s '.
-                        'should also be passed to its containing constraint %s',
-                        implode('", "', $excessGroups),
-                        get_class($constraint),
-                        get_class($this)
-                    ));
+                if (\count($excessGroups) > 0) {
+                    throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this)));
                 }
             } else {
                 $constraint->groups = $this->groups;