Home  |  Linux  | Mysql  | PHP  | XML
From:Volodymyr Iatsyshyn Date:Tue Aug 19 07:54:16 2008
Subject:Annotations Request
Hi,

Is there a chance to have annotations like in Java or like .NET attributes?

Now, I use Java Annotations emulation, through Reflections and PHPDoc 
blocks. Example:

/** Annotation One*/
class DemoAnnotation1 extends C01t_Annotation
{
     public $value;
}

/** Annotation Two*/
class DemoAnnotation2 extends C01t_Annotation
{
     public $p1;
     public $p2;
}

class DemoClass
{
     const SOME_CONST = 5;

     /** @DemoAnnotation1(DemoClass::SOME_CONST + 1) */
     public $property1;

     /** @DemoAnnotation2(p1 => 1, p2 => 'Hello, Word!') */
     public $property2;
}

Thanks,
   Volodymyr Iatsyshyn
Navigate in group php.internals at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants