今日更新后 运行报错 运行环境PHP8.3
Method 'Webman\Http\Request::file()' is not compatible with method 'Workerman\Protocols\Http\Request::file()'
Worker process terminated with ERROR: E_COMPILE_ERROR "Declaration of Webman\Http\Request::file($name = null) must be compatible with Workerman\Protocols\Http\Request::file(?string $name = null): mixed in D:\MyCode\BackEnd\ErpServer\vendor\workerman\webman-framework\src\Http\Request.php on line 119"
PHP Fatal error: Declaration of Webman\Http\Request::file($name = null) must be compatible with Workerman\Protocols\Http\Request::file(?string $name = null): mixed in D:\MyCode\BackEnd\ErpServer\vendor\workerman\webman-framework\src\Http\Request.php on line 119
/**
* File
* @param string|null $name
* @return null|UploadFile[]|UploadFile
*/
public function file($name = null)
{
$files = parent::file($name);
if (null === $files) {
return $name === null ? [] : null;
}
if ($name !== null) {
// Multi files
if (is_array(current($files))) {
return $this->parseFiles($files);
}
return $this->parseFile($files);
}
$uploadFiles = [];
foreach ($files as $name => $file) {
// Multi files
if (is_array(current($file))) {
$uploadFiles[$name] = $this->parseFiles($file);
} else {
$uploadFiles[$name] = $this->parseFile($file);
}
}
return $uploadFiles;
}
"php": ">=7.2",
"workerman/webman-framework": "1.6.4",
"monolog/monolog": "^2.0",
"illuminate/database": "^11.27",
"laravel/serializable-closure": "^1.3",
"illuminate/pagination": "^11.32",
"psr/container": "^2.0",
"php-di/php-di": "^7.0",
"doctrine/annotations": "^2.0",
"illuminate/redis": "^11.32",
"illuminate/events": "^11.29",
"vlucas/phpdotenv": "^5.6"
执行
嗯 可以了 应该是阿里源的问题 最新在1.6.4 更换源后 就能更新到1.6.6了
不用阿里源用哪个呢
我执行完 还是报这个错 我用的是php 8.3.12 执行完上面的命令之后 直接升级到5.0.0-rc.3了
composer info | grep workerman
看下workerman/webman-framework升级成功了没升级到了1.7.x
composer require workerman/webman-framework 1.6.6
能不能回退v4.2.0,我本地2.0,线上不知道怎么更新到2.1了,也是错误
composer require workerman/workerman 4.2.0
学习下composer用法吧
把阿里云镜像 却换成 腾讯云镜像 再升级成1.6.6就可以了
composer config -g repos.packagist composer https://mirrors.tencent.com/composer/
@尚新 实测有效,感谢。