I've seen this used (example from Doctrine2) in a lot of libraries that have code which works with comments:
<?php
namespace MyProject\Entities;
use Doctrine\ORM\Mapping AS ORM;
use Symfony\Component\Validation\Constraints AS Assert;
/**
* @ORM\Entity
* @MyProject\Annotations\Foobarable
*/
class User
{
/**
* @ORM\Id @ORM\Column @ORM\GeneratedValue
* @dummy
* @var int
*/
private $id;
}
I seems as though some of the comment tags are "namespaced". Is this some PHP feature that I'm not aware of (since it seems to work with the "use" statements), or is it just some smart text parsing within the library that uses these?
I am asking because I am currently developing a small class that has to read some of this "metadata", and it would be really neat if this is something that is included in the language, so I don't have to write ugly text parsers.
Many thanks in advance.