由于官方的 think-validate验证器 不兼容 PHP8.0。所以这里重复造轮子

Tinywan

项目地址

https://github.com/Tinywan/webman-validate

错误信息

#14 {main} in .../vendor/topthink/think-container/src/Container.php on line 32

Worker[17762] process terminated with ERROR: E_ERROR "During inheritance of ArrayAccess: Uncaught ErrorException: Return type of think\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in .../vendor/topthink/think-container/src/Container.php:567
2699 6 0
6个评论

yzh52521

其实这个库就没有用到 think-container 这个扩展

  • Tinywan 2021-12-28

    在Github看是没用到,但是你使用composer安装的话,会自动安装依赖 think-container 这个扩展。think-container 这个扩展官方已经不维护了

Tinywan

安装

截图

可以看出,上面是自动安装 think-container 这个扩展的

查看依赖

截图

  • yzh52521 2021-12-28

    删除依赖就好了

  • Tinywan 2021-12-28

    这个是composer自动安装的,不可以删除的

owenzhang

最后问题解决了吗?

  • 暂无评论
ichynul

think-cache,think-validate,这些。有迹象表明,会被官方逐渐放弃。
think-framework里面已经有的,又独立出来的组件,更新都不积极了。
除非像think-orm这种真的独立出来的,才会积极维护。

  • 暂无评论
深蓝

假设我有请求A,有两个方法function1和function2。

在function1中我需要验证type, $validate = Validate::rule('type', 'require|number')。

在function2中我需要验证page这个参数,$validate = Validate::rule('page', 'number|max:4')。

当我验证function2中的时候,他却报出了type必须填写,他这个$validate由于是静态方法,规则会一直存在,我现在使用->only方法似乎可以解决问题,但是感觉不够优雅,一般像这种情况该如何优雅的解决问题。

  • 暂无评论
年代过于久远,无法发表评论

Tinywan

10940
积分
0
获赞数
0
粉丝数
2020-01-14 加入
🔝