diff vendor/symfony/http-foundation/FileBag.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
line wrap: on
line diff
--- a/vendor/symfony/http-foundation/FileBag.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/http-foundation/FileBag.php	Thu Feb 28 13:21:36 2019 +0000
@@ -21,12 +21,12 @@
  */
 class FileBag extends ParameterBag
 {
-    private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
+    private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type'];
 
     /**
      * @param array $parameters An array of HTTP files
      */
-    public function __construct(array $parameters = array())
+    public function __construct(array $parameters = [])
     {
         $this->replace($parameters);
     }
@@ -34,9 +34,9 @@
     /**
      * {@inheritdoc}
      */
-    public function replace(array $files = array())
+    public function replace(array $files = [])
     {
-        $this->parameters = array();
+        $this->parameters = [];
         $this->add($files);
     }
 
@@ -45,7 +45,7 @@
      */
     public function set($key, $value)
     {
-        if (!is_array($value) && !$value instanceof UploadedFile) {
+        if (!\is_array($value) && !$value instanceof UploadedFile) {
             throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
         }
 
@@ -55,7 +55,7 @@
     /**
      * {@inheritdoc}
      */
-    public function add(array $files = array())
+    public function add(array $files = [])
     {
         foreach ($files as $key => $file) {
             $this->set($key, $file);
@@ -76,7 +76,7 @@
         }
 
         $file = $this->fixPhpFilesArray($file);
-        if (is_array($file)) {
+        if (\is_array($file)) {
             $keys = array_keys($file);
             sort($keys);
 
@@ -87,7 +87,7 @@
                     $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']);
                 }
             } else {
-                $file = array_map(array($this, 'convertFileInformation'), $file);
+                $file = array_map([$this, 'convertFileInformation'], $file);
                 if (array_keys($keys) === $keys) {
                     $file = array_filter($file);
                 }
@@ -113,14 +113,14 @@
      */
     protected function fixPhpFilesArray($data)
     {
-        if (!is_array($data)) {
+        if (!\is_array($data)) {
             return $data;
         }
 
         $keys = array_keys($data);
         sort($keys);
 
-        if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) {
+        if (self::$fileKeys != $keys || !isset($data['name']) || !\is_array($data['name'])) {
             return $data;
         }
 
@@ -130,13 +130,13 @@
         }
 
         foreach ($data['name'] as $key => $name) {
-            $files[$key] = $this->fixPhpFilesArray(array(
+            $files[$key] = $this->fixPhpFilesArray([
                 'error' => $data['error'][$key],
                 'name' => $name,
                 'type' => $data['type'][$key],
                 'tmp_name' => $data['tmp_name'][$key],
                 'size' => $data['size'][$key],
-            ));
+            ]);
         }
 
         return $files;