CakePHP 4.x身份验证2.x -启动时发生致命错误

lhcgjxsq  于 2022-11-11  发布在  PHP
关注(0)|答案(1)|浏览(170)

我刚刚安装了CakePHP 4.x(确切地说是4.x-dev),并安装了身份验证插件(2.x-dev)。https://github.com/cakephp/authentication/blob/2.x-get/docs/Quick-start-and-introduction.md
我添加了必要的使用声明implements AuthenticationServiceProviderInterface,并添加了getAuthenticationService(ServerRequestInterface $request)函数,以及必要的中间件添加,但是我得到了一个致命错误:
致命错误:应用程序\应用程序::获取认证服务(Psr\Http\消息\服务器请求接口$请求)的声明必须与认证\认证服务提供商接口::获取认证服务(Psr\Http\消息\服务器请求接口$请求)兼容:在第40行的/src/应用程序. php中的验证\身份验证服务接口。
第40行是:

class Application extends BaseApplication implements AuthenticationServiceProviderInterface
wdebmtf2

wdebmtf21#

您缺少Application::getAuthenticationService()方法的返回类型提示。
它应该与下面的www.example.com类似https://github.com/cakephp/authentication/blob/master/src/AuthenticationServiceProviderInterface.php#L32

相关问题