文件 vendor/workerman/gateway-worker/src/Register.php
测试环境 PHP 8.4 指定了强类型 declare (strict_types=1); 运行时会报错
GatewayWorker\Register::__construct(): Implicitly marking parameter $socketName as nullable is deprecated, the explicit nullable type must be used instead
// 现有代码采用隐式null导致报错
public function __construct(string $socketName = null, array $contextOption = [])
{
$this->name = 'Register';
$this->reloadable = false;
parent::__construct($socketName, $contextOption);
}
// 修改后代码不会报错
public function __construct(?string $socketName = null, array $contextOption = [])
{
$this->name = 'Register';
$this->reloadable = false;
parent::__construct($socketName, $contextOption);
}
"workerman/gateway-worker": "3.1.18"
PHP8.4才出多久啊,有多少包支持啊,这么急着用么。。。可以提PR,也为workerman做贡献了!
这应该不是php8.4的问题是 涉及到强类型的问题