Bringing annotations to Yii


 * @required

 * @property $bar


 * @table('name'=>'items')


class Test


this can be easily confused with annotating a class with @required, especially at a glance view, when annotating the class makes sense

writing an anonymous function within phpdoc-comments is not a good idea, it doesn’t make big sense even if annotations is a part of language… I think so

The last variant is the most safe and understandable

I agree.

Unfortunately, it’s not compatible with PHP-DOC - documentation generators and IDEs are going to interpret that last bracket and following line of annotation as being part of the comments for the first annotation.

I’ve contacted the PHP-DOC developers to see if they would be interested in adding support for this to the PHP-DOC standard in some form. I can’t think of any other real way around this problem…

Okay, I contacted the PHP-DOC developers, and they said I was welcome to contribute a patch.

I took a look at their parser, and unfortunately, there’s no way I can dedicate the amount of time it would take to find my way around this mother of a codebase.

I wonder if I would be better off adding a syntax like the first one, or dropping the annotation of virtual members altogether. It feels weird to me in the first place, and if Yii no longer needs it, maybe it would be better not to have this feature, as opposed to having to explain how it works and why it’s there?

If virtual members aren’t really needed for AR anymore, and can be declared as regular public members, perhaps that’s the best approach.

I realize virtual members are a part of the PHP language, but come to think of it, virtual members are part of most other languages, and I’ve never seen annotation of virtual members supported anywhere else.

Do you think it would be acceptable to drop this feature, at least from the 1.0 branch, so I can get this thing to release this century? :slight_smile:

Any opinions?