I'm documenting my Zend Framework view helpers and controller plugins using phpdoc @method tags to get better code assist in my IDE (PHPStorm). View helpers and controller plugins are called via __invoke() magic methods.
For example, I have a DateTime view helper:
class DateTime extends AbstractHelper
{
public function __invoke($dateTimeString, $date = true, $time = true, $seconds = false)
{
// ...
}
}
which is documented as follows:
/**
* @method string dateTime($dateTimeString, $date = true, $time = true, $seconds = false)
*/
class PhpRenderer extends \Zend\View\Renderer\PhpRenderer
{
}
Instead of repeating the function signature in the @method tag, is there a way to alias or reference the __invoke function? So I wouldn't have to keep the @method tags in sync with the __invoke() method parameters and IDEs could link calls directly to the magic method.
Something like this would be nice:
/**
* @method dateTime \MyLib\View\Helper\DateTime::__invoke
*/
If @method could also take a reference to another (magic) method, PHP frameworks could document their magic (__invoke, __call, etc) better and IDEs could link directly to the implementation. Or maybe another tag name should be used for this, e.g. @alias, @call, @invoke.