我在我的PHP应用程序中使用几个关联数组,我使用PHP documentor来评论我的来源。我从来没有真的为数组中的数组指定注释,但现在我需要这样做,不知道如何。评论关联数组在PHP Documentor
$array = array('id' => 'test', 'class' => 'tester', 'options' => array('option1' => 1, 'option2' => 2))
如何评论这个数组中的@var
和@param
意见正确的方法是什么? 我能做到这一点是这样,但我不知道这是否是正确的:
@param string $array['id']
@param string $array['class']
@param int $array['options']['option1']
但如何为@var
部分做到这一点?
感谢您的帮助;) – Abenil 2010-05-02 01:06:12
这已被证实可以在任何IDE中使用auto-complete/intellisense,我想知道吗?根据[类型定义的phpDoc ABNF](http://www.phpdoc.org/docs/latest/for-users/types.html#abnf),没有为数组索引指定类型的限制。它将数组指定为'@var string []'('array'组件仅适用于“未指定”数组)。 – Sepster 2012-09-08 16:40:49
@Sepster不幸的是,我不认为大多数IDE都足够聪明来认识到这一点。你的里程可能会有所不同,但我甚至发现Zend Studio的实现有点缺乏,当涉及到这种类型的意识类型。 – 2012-09-18 22:28:48