@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?

7 comments
Comment actions Permalink

What language?

0
Comment actions Permalink

Hi there,

As far as I know (and accordingly to the PHP Manual) the php variable cannot contain $ inside its name.

0
Comment actions Permalink

Hi,

This is actually possible. for example:

$object = json_decode( '{ "some\$thing": "dollars in property names suck"}');

print_r($object);

echo $object->{'some$thing'};

0
Comment actions Permalink

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.

0
Comment actions Permalink

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")

0
Comment actions Permalink

Thanks for your answers, I have opened an issue here https://youtrack.jetbrains.com/issue/WI-27691

0

Please sign in to leave a comment.