Comment associative array in PHP Documentor

前端 未结 3 1704
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 14:08

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, b

3条回答
  •  半阙折子戏
    2020-12-01 14:45

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

    You could do something like this:

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

提交回复
热议问题