@property annotation
Hi,
An API I'm using is returning properties with a $ in the name. For autocompletion I want to add a @property annotation, but I cannt get it to autocomplete.
Some stuff I tried:
/**
* @property string some$thing
* @property string {some$thing}
* @property string {'some$thing'}
* @property string {some\$thing}
*/
Class A {
}
Does anyone know how to fix this or if it is possible at all?
请先登录再写评论。
What language?
PHP
Hi there,
As far as I know (and accordingly to the PHP Manual) the php variable cannot contain $ inside its name.
Hi,
This is actually possible. for example:
$object = json_decode( '{ "some\$thing": "dollars in property names suck"}');
print_r($object);
echo $object->{'some$thing'};
The OP's question was whether this was possible using the PHPDoc @property syntax (perhaps using some kind of string interpolation) rather than yielding the variable in PHP code.
My fault -- I completely forgot about that syntax.
In such case (since you have tried all combinations already) I may only suggest to file a ticket to the Issue Tracker.
Sidenote: property name should start with $ in @property declaration as well (i.e. "@property string $abc My optional description")
Thanks for your answers, I have opened an issue here https://youtrack.jetbrains.com/issue/WI-27691