Zend Framework 2 form annotations are ignored without extra space

I banged my head against the wall for hours. Shortcuts for form fields did not appear no matter what.

Finally, it turned out that without additional space where the cursor is located (see image), all annotations are ignored. I am using ZF 2.1.1 with Doctrine Common 2.2.3.

Am I doing something wrong? Or is it a bug in ZF or the Doctrine parser?

Eclipse screenshot

Works:

class LoginForm { /** @Annotation\Type("text") * @Annotation\Options({"label":"Store ID:"}) * @Annotation\Required(true) * @Annotation\Filter({"name":"StringTrim"}) * @Annotation\Validator({"name":"StringLength","options":{"min":2,"max":64}}) */ public $sStoreId; } 

Fail if there is no space after / **:

  class LoginForm { /** * @Annotation\Type("text") * @Annotation\Options({"label":"Store ID:"}) * @Annotation\Required(true) * @Annotation\Filter({"name":"StringTrim"}) * @Annotation\Validator({"name":"StringLength","options":{"min":2,"max":64}}) */ public $sStoreId; } 
+4
source share
2 answers

There seems to be no solution, so use one of the workarounds asked in the original question:

  • add a space after / ** (easy to forget)
  • put the first annotation or any text comment on the same line as / **
+1
source

Since the annotation uses the php-doc standard, the first line always contains a comment / description. It must be given. If you do not provide a comment / description, leave a blank line.

+1
source

All Articles