Skip to content

Instantly share code, notes, and snippets.

@mvriel
Created October 2, 2012 19:49
  • Star 20 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mvriel/3822861 to your computer and use it in GitHub Desktop.
Option arrays in PHPDoc
<?php
/*
This code sample demonstrates several style for representing an option array with
the following fields: name, label, type_id, visible, default.
When designing this we should keep in mind that the option key may be represented
by either a literal or a (class)constant. As such we mix and match those for
illustrative purposes.
*/
const NAME = "name";
/**
* ...
*
* @param array $options [description]
* @option string NAME [description]
* @option string "label" [description]
* @option integer "type_id" [description]
* @option boolean "visible" [description]
* @option string "default" [description]
*
* @return void
*/
function ryan_parman($options = array())
{
}
/**
* ...
*
* @param mixed[] $options [description] {
* @type string NAME [description]
* @type string "label" [description]
* @type integer "type_id" [description]
* @type boolean "visible" [description]
* @type string "default" [description]
* }
*
* @return void
*/
function mike_van_riel($options = array())
{
}
/**
* ...
*
* @param `Options` $options [description]
*
* @struct Options {
* @type string NAME [description]
* @type string "label" [description]
* @type integer "type_id" [description]
* @type boolean "visible" [description]
* @type string "default" [description]
* }
*
* @return void
*/
function mike_van_riel2($options = array())
{
}
@skyzyx
Copy link

skyzyx commented Nov 1, 2012

Is anybody working on a way to parse the contents of braces (e.g., {...}) yet?

Whether or not we use param, option, struct, or anything else, they all seem to depend on the ability to parse the contents of braces as sub-blocks.

I just wanted to know before I start this work myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment