문제

I would like to describe a "foreach" loop with javadoc.

Maybe like this ??

<?php 
/**
 * @var array $rowset
 * @var \MyClass $row
 */
foreach($rowset as $row){

}

could you validate my syntax ?

도움이 되었습니까?

해결책

I suspect you only want to provide type hints to your PHP IDE rather than build HTML documentation. In that case you want variable type annotations:

/* @var $rowset array */
/* @var $row \MyClass */

Please note that it's a different feature than docblocks used by javadoc clones. Main differences are:

  • Start with /* rather than /**
  • Argument order is swapped
  • Used in different context (@var docblock precedes a property definition, @var variable type precedes a regular variable usage)
  • Aimed at IDEs rather than API documentation generators

They are supported by at least NetBeans and PhpStorm.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top