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

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/Collection.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/validator/Constraints/Collection.php	Thu Feb 28 13:21:36 2019 +0000
@@ -24,12 +24,12 @@
     const MISSING_FIELD_ERROR = '2fa2158c-2a7f-484b-98aa-975522539ff8';
     const NO_SUCH_FIELD_ERROR = '7703c766-b5d5-4cef-ace7-ae0dd82304e9';
 
-    protected static $errorNames = array(
+    protected static $errorNames = [
         self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR',
         self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR',
-    );
+    ];
 
-    public $fields = array();
+    public $fields = [];
     public $allowExtraFields = false;
     public $allowMissingFields = false;
     public $extraFieldsMessage = 'This field was not expected.';
@@ -41,9 +41,9 @@
     public function __construct($options = null)
     {
         // no known options set? $options is the fields array
-        if (is_array($options)
-            && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) {
-            $options = array('fields' => $options);
+        if (\is_array($options)
+            && !array_intersect(array_keys($options), ['groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'])) {
+            $options = ['fields' => $options];
         }
 
         parent::__construct($options);
@@ -56,14 +56,14 @@
     {
         parent::initializeNestedConstraints();
 
-        if (!is_array($this->fields)) {
+        if (!\is_array($this->fields)) {
             throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s', __CLASS__));
         }
 
         foreach ($this->fields as $fieldName => $field) {
             // the XmlFileLoader and YamlFileLoader pass the field Optional
             // and Required constraint as an array with exactly one element
-            if (is_array($field) && 1 == count($field)) {
+            if (\is_array($field) && 1 == \count($field)) {
                 $this->fields[$fieldName] = $field = $field[0];
             }
 
@@ -75,7 +75,7 @@
 
     public function getRequiredOptions()
     {
-        return array('fields');
+        return ['fields'];
     }
 
     protected function getCompositeOption()