Re: Reflecting Constants.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It would seem that without tokenising the class file, I'm sort of
stuck with the solution I've got at the moment.

Unless anyone has any ideas!

I faced similar problem with constants when doing WSDL generator. In my case I wanted to extract constant description to include it in WSDL documentation section. Unfortunately PHP Reflection API exposes only ReflectionClass::getConstants method which doesn't return PHPDoc comments.

My solution was to put following annotation in class PHPDoc for each constant in the class:
@constant CONSTANT_NAME Description of constant.

Of course you need to keep constant names in PHPDoc synchronised with code, but in my case this annotation is required for every constant so I get notified about any problems with it.

--
Tomasz Sawicki

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux