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.)