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
think-cache,think-validate,這些。有跡象表明,會(huì)被官方逐漸放棄。
think-framework里面已經(jīng)有的,又獨(dú)立出來的組件,更新都不積極了。
除非像think-orm這種真的獨(dú)立出來的,才會(huì)積極維護(hù)。
假設(shè)我有請(qǐng)求A,有兩個(gè)方法function1和function2。
在function1中我需要驗(yàn)證type, $validate = Validate::rule('type', 'require|number')。
在function2中我需要驗(yàn)證page這個(gè)參數(shù),$validate = Validate::rule('page', 'number|max:4')。
當(dāng)我驗(yàn)證function2中的時(shí)候,他卻報(bào)出了type必須填寫,他這個(gè)$validate由于是靜態(tài)方法,規(guī)則會(huì)一直存在,我現(xiàn)在使用->only方法似乎可以解決問題,但是感覺不夠優(yōu)雅,一般像這種情況該如何優(yōu)雅的解決問題。
其實(shí)這個(gè)庫就沒有用到 think-container 這個(gè)擴(kuò)展