Ticket #110 (closed documentation issue: fixed)

Opened 3 years ago

Last modified 3 years ago

Allow annotations for method/function parameters

Reported by: mikey Owned by: mikey
Priority: minor Milestone: 0.4.0
Component: ReflectionApi Version: SVN-trunk
Keywords: Cc: schst

Description (last modified by mikey) (diff)

An idea how to implement annotations for method and function parameters:

/**
 * a foo function
 *
 * @param  string  $bar
 * @Annotation{bar}(attribute='value')
 */
function foo($bar) { ... }

The curly braces will mark the annotation as belonging to the parameter declared within the braces. With other words, the annotation in the example above is annotated to the param $bar, not to the function foo().

This would require to extend the annotation parser with a new state that is able to detect such an annotation. Of course, this declarations should be allowed, too:

/**
 * a foo function
 *
 * @param  string  $bar
 * @Annotation[CastedAnnotation]{bar}(attribute='value')
 * @Annotation{bar}[CastedAnnotation](attribute='value')
 */
function foo($bar) { ... }

(Only one of them, this example just shows that the sequence should not be fixed.)

Change History

Changed 3 years ago by mikey

  • description modified (diff)

Changed 3 years ago by mikey

  • status changed from new to assigned

Changed 3 years ago by mikey

  • priority changed from major to minor
  • type changed from enhancement to documentation issue
  • milestone set to 0.4.0

Implemented with changeset 1072. Documentation needs to be updated.

Changed 3 years ago by mikey

  • status changed from assigned to closed
  • resolution set to fixed

Documentation updated.

Note: See TracTickets for help on using tickets.