2010-08-27 65 views
0

我正在解决一个问题,但真的不明白为什么!不兼容的内核方法签名

I(经由前端控制器或CLI)

PHP Fatal error: Declaration of ECommerceKernel::registerContainerConfiguration() must be compatible with that of Symfony\Framework\Kernel::registerContainerConfiguration() 

的问题是registerContainerConfiguration方法的超控启动的Symfony时得到这个错误。

它的签名中的Symfony \框架\内核定义:

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之后。

回答

1

在这里,我拥有它!

对不起,我刚发现我的错误。

上LoaderInterface $装载机制造的类型提示必须是

Symfony\Component\DependencyInjection\Loader\LoaderInterface; 

和我使用的是

Symfony\Components\DependencyInjection\Loader\LoaderInterface 

的问题出现了,因为http://github.com/symfony/symfony/commit/bf82cf42dda099f8c0b6648b7dbd8e8ea7397c1e

可耻的是我,因为我是意识到这一点(已在symfony-devs列表中公布)。

问题是,当PHP尝试使用不明智的类时,PHP解析器不会警告您。

或者我错过了什么?

相关问题