Symfony2的。 如何确保控制器实现某些方法无论是公共/私有/受保护还是有任何参数?

I wonder if I can make controllers implementing some methods no matters if that method will be public, private or protected and if it will have any parameter. I just want to ensure, that controller has method with specified name, no more.

For example:

interface SomeInterface {
  function someFunction();
  function someOtherFunction();
}

class SomeController extends SomeBaseController implements SomeInterface {
  //some action
  public function someAction() { ... }

  //an implementation of SomeInterface method
  public function someFunction() { ... }  

  //an implementation of SomeInterface method
  protected function someOtherFunction($someParameter) { ... }
}

I know that it's not possible to do this with ordinary php interfaces but maybe there is some other way in php or maybe symfony2 has some tool to accomplish this?

It seems there is no way to accomplish this. So I mark my question as reslolved, however if someone knows an answer let me know! :)

I know of one way to do this, which relies on the __call() method available in PHP: http://www.php.net/manual/en/language.oop5.overloading.php#object.call

__call() is triggered when invoking inaccessible methods in an object context. 

You could go ahead and create a parent class that looks like this - although it's not an Interface, so take care if you need it outside a single domain.

class BaseClass{

    public function __call($name, $arguments) {
        $methodsToImplement = array(
            'method1', 'method2', 'method3'
        );

        if (in_array($name, $methodsToImplement)) {
            throw new Exception("Method " . $name . " is not yet implemented.");
        }
    }
}