-
Notifications
You must be signed in to change notification settings - Fork 12
@AnnotationCreator
JonathanO edited this page Jun 3, 2012
·
4 revisions
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.
- params (Parameter[]) The properties to be used as parameters to the annotated method, in order.
- name (string) The parameter name, if not provided then the argument name is used
- type (string) The type of the parameter (default "string".) See AnnotationTypes
- required (bool) Is this parameter required (default false)
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)