Skip to content
JonathanO edited this page Jun 3, 2012 · 4 revisions

AnnotationCreator

Used on the constructor or a static method to mark it as the factory method for this object. It optionally takes a single argument consisting of an array of @Parameter annotations, which will be used in specified order as the parameters to the factory/constructor.

Parameters

  1. params (Parameter[]) The properties to be used as parameters to the annotated method, in order.

Parameter

  1. name (string) The parameter name, if not provided then the argument name is used
  2. type (string) The type of the parameter (default "string".) See AnnotationTypes
  3. required (bool) Is this parameter required (default false)

Examples

Construct this object using the constructor.

<?
/**
 * @Annotation
 */
class Bar {

/**
 * @AnnotationCreator({@Parameter(name="foo", type="string")})
 */
public function __construct($foo) {

Which will allow Bar to be used as:

  • @Bar("value of foo")
  • @Bar(foo="value of foo")
  • @Bar (as foo is optional)

Back to Annotations list

Clone this wiki locally