Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 不兼容核方法签名_Php_Symfony - Fatal编程技术网

Php 不兼容核方法签名

Php 不兼容核方法签名,php,symfony,Php,Symfony,我遇到了一个问题,但真的不明白为什么 启动Symfony时(通过前端控制器或CLI)出现此错误 问题在于重写registerContainerConfiguration方法 它的签名在Symfony\Framework\Kernel中定义: abstract public function registerContainerConfiguration(LoaderInterface $loader); 我的覆盖方法如下所示: // in ECommerceKernel public funct

我遇到了一个问题,但真的不明白为什么

启动Symfony时(通过前端控制器或CLI)出现此错误

问题在于重写registerContainerConfiguration方法

它的签名在Symfony\Framework\Kernel中定义:

abstract public function registerContainerConfiguration(LoaderInterface $loader);
我的覆盖方法如下所示:

// in ECommerceKernel
public function registerContainerConfiguration(LoaderInterface $loader)
{
    $return = $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');

    $em = $this->getContainer()->getDoctrine_Orm_EntityManagerService();
    $dm = $this->getContainer()->getDoctrine_Odm_Mongodb_DocumentManagerService();

    $eventManager = $em->getEventManager();
    $eventManager->addEventListener(
        array(\Doctrine\ORM\Events::postLoad), new ECommerceEventSubscriber($dm)
    );

    return $return;
}
我的问题:这里到底发生了什么?我真的无法理解这个错误,因为方法签名完全相同

这是在srv/vendor/symfony升级到最新的github的symfony/symfony之后发生的。

我找到了

对不起,吵闹了,但我刚刚发现了我的错误

LoaderInterface$loader上的类型提示必须是

Symfony\Component\DependencyInjection\Loader\LoaderInterface;
我用的是一个

Symfony\Components\DependencyInjection\Loader\LoaderInterface
从那以后问题就出现了

我真丢脸,因为我早就意识到了这一点(这已经在symfony devs列表中公布)

问题是,当您尝试使用非访问类时,PHP解释器不会发出警告

或者我错过了什么

Symfony\Components\DependencyInjection\Loader\LoaderInterface