Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon 2.0.0 InjectionAwareInterface Method Signature Bug?

When we upgraded to Phalcon 2.0.0 all of our classes that implemented the InjectionAwareInterface not require the type declaration in the setDi method. So previously the function declaration was:

public function setDi($di) { $this->_di = $di; }

This no longer works and now requires the type declaration Phalcon\DiInterface on the argument. So the new declaration must be:

public function setDi(\Phalcon\DiInterface $di) { $this->_di = $di; }

I am not sure if this was by design or a bug as none of the other documentation or items in teh changelog mention this major change.



Yes, you have to update the signature of the methods, as now Zephir validates these interfaces, this is mentioned in the upgrading guide: