评论关联数组在PHP文件处理器 [英] Comment associative array in PHP Documentor

查看:149
本文介绍了评论关联数组在PHP文件处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用几个关联数组在我的PHP应用程序,我使用PHP文档编辑评论我的消息来源。我从来没有真的指定数组中的数组意见,但现在我需要做的,不知道怎么办。

I use several associative arrays in my PHP application and I'm using PHP documentor to comment my sources. I never really did specify comments for the arrays in an array, but now I need to do that and don't know how.

$array = array('id' => 'test', 'class' => 'tester', 'options' => array('option1' => 1, 'option2' => 2))

我如何评论这个数组以正确的方式为 @var @param 的意见?
我能做到这一点是这样,但我不知道这是否是正确的:

How do I comment this array in the correct way for @var and @param comments? I could do this like this, but I don't know if this is correct:

@param string $array['id']
@param string $array['class']
@param int $array['options']['option1']

但如何为 @var 部分做到这一点?

推荐答案

您不能记录每个按键,但你可以告诉phpDocumentor的它是什么类型

You can't document each key, but you can tell phpDocumentor what type it is.

您可以做这样的事情:

/**
 * Form the array like this:
 * <code>
 * $array = array(
 *   'id'      => 'foo',          // the id
 *   'class'   => 'myClass',     // the class
 * );
 * 
 * </code>
 *
 * @var array[string]string 
 */
$array;

这篇关于评论关联数组在PHP文件处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆