Question

I'm using zend framework 2 with PHPStorm 7.1.2

Inside my view I want to have code completion for $this->form().

Here is the code:

Controller:

public function indexAction() {
    $viewModel = new ViewModel();
    $form = new SearchForm('search');
    $viewModel->setVariable('form', $form);
    return $viewModel;
}

View:

<?php
/**
 * @var \Zend\View\Renderer\PhpRenderer $this
 * @var \Application\Form\SearchForm $form
 */
?>

<?php $form->setAttribute(...); ?>
<?php $form->prepare(); ?>
<?php $this->form()->openTag($form); ?>

...

<?php $this->form()->closeTag(); ?>

In my view I got code completion on e.g. $this->url(...); and on $form->setAttribute(...);.

How must I annotate my file to get code completion on $this->form()?

PHPStorm tells something about

Method 'form' not found in class Zend\View\Renderer\PhpRenderer

...

Thanks, Jens

No correct solution

OTHER TIPS

$this->form() as well as $this->formXY() are ViewHelpers and you won't get any kind of type-hinting for those.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top