php8.4 webman/think-cache安装后报错:函数参数nullable类型声明不兼容

Elaborate

问题描述

安装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

截图报错信息里报错文件相关代码

操作系统及workerman/webman等框架组件具体版本

PHP/8.4.4 (Jit off)
webmanV2.1.2

181 1 0
1个回答

jack10082009

我记得从PHP8.4开始,如果指定变量类型(严格模式)的话,函数的string形参默认值不能为null。你可以将其默认值改为''(空字符串)。但是这样下面如果使用了(??)这个简化的null检查三元运算符应该改为(?:)这个简化的空检查三元运算符。
可以看一下PHP官方文档中有这个相关说明。

  • 暂无评论
×
🔝