It is easy to retrieve the doc comment for methods and properties. But what about constants? There is no ReflectionConstant
class which would allow me to call getDocComment()
on them. It's possible to get the list of constants and their values as strings using ReflectionClass::getConstants
but that's all. Is there a workaround?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Why does const allow implicit conversion of refere
- Can php detect if javascript is on or not?
To my best knowledge there is no built-in function or class that allows you to retrieve class constant doc comments. However, you can use
token_get_all($classContent)
and write your own parser.Here is what I have come up with, after needing this feature as well: