安装think-cache后报错,php8.4 函数参数类型声明不兼容
ErrorException: Webman\ThinkCache\CacheManager::getConfig(): Implicitly marking parameter $name as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/webman/think-cache/src/CacheManager.php:50
PHP/8.4.4 (Jit off)
webmanV2.1.2
我记得从PHP8.4开始,如果指定变量类型(严格模式)的话,函数的string形参默认值不能为null。你可以将其默认值改为''(空字符串)。但是这样下面如果使用了(??)这个简化的null检查三元运算符应该改为(?:)这个简化的空检查三元运算符。
可以看一下PHP官方文档中有这个相关说明。
是的,我看有提交pr都没合并,估计不更新了。
刚发了 v2.1.2 试下
v2.1.2也是报错: ErrorException: Webman\ThinkCache\CacheManager::getConfig(): Implicitly marking parameter $name as nullable is deprecated, the explicit nullable type must be used instead in
升级后重启下
重启过了, 重新建一个新的项目, 然后再重启也是一样
执行composer info 版本,看下是否真的升级成功了
webman/think-cache 2.1.1
workerman/webman-framework 2.1.2 High performance HTTP Service Framework.
workerman/workerman 5.1.1 An asynchronous event driven PHP framework for easily building fast, scalable network applications.
webman/think-cache 2.1.2
执行: composer require webman/think-cache v2.1.2
报错:
Problem 1
不要用 composer 代理
好的 好的, 可以啦 😁