cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[Enhancement] DispatcherInterface definition

Open kornerita opened this issue 9 years ago • 1 comments

Hi,

I was looking into the controller's access to the Dispatcher through the dependency injection as property and I've found the following:

\Phalcon\Mvc\Controller extends \Phalcon\Di\Injectable where the $dispatcher property is declared here Phalcon\Di\Injectable as:

@property \Phalcon\Mvc\Dispatcher|\Phalcon\Mvc\DispatcherInterface $dispatcher

If you treat that $dispatcher as a \Phalcon\Mvc\Dispatcher then you "can't" replace it for a component that implements \Phalcon\Mvc\DispatcherInterface

And if you treat $dispatcher as a \Phalcon\Mvc\DispatcherInterface then you "can't" use the methods declared in Phalcon\DispatcherInterface that are implemented by the parent of \Phalcon\Mvc\Dispatcher since these are not in the declaration of \Phalcon\Mvc\DispatcherInterface.

My proposition is to add the methods of Phalcon\DispatcherInterface to \Phalcon\Mvc\DispatcherInterface for consistency and replace the @property declaration to:

@property \Phalcon\Mvc\DispatcherInterface $dispatcher

Details

  • Phalcon version: 3.2.1
  • PHP Version: not relevant
  • Operating System:not relevant
  • Installation type: not relevant
  • Zephir version (if any):
  • Server: not relevant
  • Other related info (Database, table schema): not relevant

kornerita avatar Aug 09 '17 15:08 kornerita

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

stale[bot] avatar Apr 16 '18 17:04 stale[bot]