diff vendor/symfony/dom-crawler/Field/ChoiceFormField.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
line wrap: on
line diff
--- a/vendor/symfony/dom-crawler/Field/ChoiceFormField.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/dom-crawler/Field/ChoiceFormField.php	Thu Feb 28 13:21:36 2019 +0000
@@ -45,7 +45,7 @@
     public function hasValue()
     {
         // don't send a value for unchecked checkboxes
-        if (in_array($this->type, array('checkbox', 'radio')) && null === $this->value) {
+        if (\in_array($this->type, ['checkbox', 'radio']) && null === $this->value) {
             return false;
         }
 
@@ -75,7 +75,7 @@
     /**
      * Sets the value of the field.
      *
-     * @param string $value The value of the field
+     * @param string|array $value The value of the field
      */
     public function select($value)
     {
@@ -126,7 +126,7 @@
             // check
             $this->value = $this->options[0]['value'];
         } else {
-            if (is_array($value)) {
+            if (\is_array($value)) {
                 if (!$this->multiple) {
                     throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name));
                 }
@@ -144,7 +144,7 @@
                 $value = (array) $value;
             }
 
-            if (is_array($value)) {
+            if (\is_array($value)) {
                 $this->value = $value;
             } else {
                 parent::setValue($value);
@@ -211,7 +211,7 @@
         }
 
         $this->value = null;
-        $this->options = array();
+        $this->options = [];
         $this->multiple = false;
 
         if ('input' == $this->node->nodeName) {
@@ -226,7 +226,7 @@
             $this->type = 'select';
             if ($this->node->hasAttribute('multiple')) {
                 $this->multiple = true;
-                $this->value = array();
+                $this->value = [];
                 $this->name = str_replace('[]', '', $this->name);
             }
 
@@ -261,7 +261,7 @@
      */
     private function buildOptionValue(\DOMElement $node)
     {
-        $option = array();
+        $option = [];
 
         $defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on';
         $defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : $defaultDefaultValue;
@@ -301,7 +301,7 @@
      */
     public function availableOptionValues()
     {
-        $values = array();
+        $values = [];
 
         foreach ($this->options as $option) {
             $values[] = $option['value'];