Type -> (arrow) when pressed . (dot)

Hi,

Basicly, when I'm typing object like $obj->member $obj->method() I want to type with dots
Like: $obj.member and $obj.method()

I'm a java guy, I'm really used to that and I really work with objects.

I remember (probably it was in Qt Creator IDE) when I pressed . (dot) it was automatically changing it to -> (arrow).

Do you have this feature in PhpStorm?

6 comments
Comment actions Permalink

Hi Sereg,

PhpStorm has no such functionality... and I see no reason why it should, since dot is a special character in PHP and used for string concatenation operations.

However, using Live Templates (Settings | Live Templates) you may achieve similar behaviour, but that still will be 2 keys to press, for example "dot" + "tab" (shortcut abbreviation + expanding/processing key), which still should be more convenient to type compared to "->".

0
Comment actions Permalink

Well yeah there would be an ambiguity there with concatenation.

Actually for concatenation people can put space first after the object, and then press dot. It is possible to implement.

Thanks for your explanation Andriy.

0
Comment actions Permalink

Yeah, Java guys must suffer to have to press three keys (minus, shift, dot) instead of one (dot) to autocomplete instance fields...

0
Comment actions Permalink

Yeah, Java guys must suffer to have to press three keys (minus, shift, dot) instead of one (dot) to autocomplete instance fields...

In fact, just a minus is totally enough for completion to appear in PhpStorm.

0
Comment actions Permalink

It only works for `$this`. For other variables I have to type "-" and ">" to get to autocompletion list.

0

Please sign in to leave a comment.