修复 php8.4 下:Implicitly marking parameter $env as nullable is deprecated

php8.4 下使用队列命令:php think queue:listen 等会触发这个错误
```bash
[think\exception\ErrorException]
think\Process::__construct(): Implicitly marking parameter $env as nullable is deprecated, the explicit nullable type must be used instead
```

相关参考:https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Signed-off-by: Abel <seekcx@qq.com>
This commit is contained in:
Abel
2025-08-22 07:22:40 +00:00
committed by Gitee
parent d32996a0d5
commit 00e54c7964

View File

@@ -123,7 +123,7 @@ class Process
* @throws \RuntimeException
* @api
*/
public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = [])
public function __construct($commandline, $cwd = null, ?array $env = null, $input = null, $timeout = 60, array $options = [])
{
if (!function_exists('proc_open')) {
throw new \RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');