0

The task is simple, I want to add type hinting in Netbeans so I can get code assist in view files. How to do it the right way? The example below does not work:

/**
 * @var \Zend\Paginator\Paginator $this->paginator
 */
$pageOffset = ($this->paginator->getCurrentPageNumber() - 1) * $this->paginator->getItemCountPerPage();

This is done in phtml file not php class file.

Antoniossss
  • 31,590
  • 6
  • 57
  • 99

2 Answers2

2

Many IDEs fail to provide type hinting for view properties in view files.

One workaround would be to assign the property of the view class to a new variable at the top of the view file.

/**
 * @var \Zend\Paginator\Paginator $paginator
 */
$paginator = $this->paginator;
Michal M.
  • 1,072
  • 1
  • 11
  • 14
0

You used the wrong order. Variable name comes first, then the type. Also write it in one line.

/* @var $this->paginator \Zend\Paginator\Paginator */
Hubbe73
  • 31
  • 5