浏览代码

array_merge replaced with spread syntax

Mark Magyar 2 年之前
父节点
当前提交
a1fb67b2e1
共有 2 个文件被更改,包括 3 次插入9 次删除
  1. 1 6
      src/Protocols/Http/Request.php
  2. 2 3
      src/Worker.php

+ 1 - 6
src/Protocols/Http/Request.php

@@ -606,12 +606,7 @@ class Request
                         }
                         $uploadKey = $fileName;
                         // Parse upload files.
-                        $file = array_merge($file, [
-                            'name' => $match[2],
-                            'tmp_name' => $tmpFile,
-                            'size' => $size,
-                            'error' => $error
-                        ]);
+                        $file = [...$file, 'name' => $match[2], 'tmp_name' => $tmpFile, 'size' => $size, 'error' => $error];
                         if (!isset($file['type'])) $file['type'] = '';
                         break;
                     } // Is post field.

+ 2 - 3
src/Worker.php

@@ -1042,7 +1042,7 @@ class Worker
     public static function getArgv(): array
     {
         global $argv;
-        return static::$command ? array_merge($argv, explode(' ', static::$command)) : $argv;
+        return static::$command ? [...$argv, ...explode(' ', static::$command)] : $argv;
     }
 
     /**
@@ -2259,7 +2259,7 @@ class Worker
             && \strtolower(\php_uname('s')) !== 'darwin' // if not Mac OS
             && strpos($socketName,'unix') !== 0 // if not unix socket
             && strpos($socketName,'udp') !== 0) { // if not udp socket
-            
+
             $address = \parse_url($socketName);
             if (isset($address['host']) && isset($address['port'])) {
                 try {
@@ -2608,4 +2608,3 @@ class Worker
         return stripos($content, 'WorkerMan') !== false || stripos($content, 'php') !== false;
     }
 }
-