Code Faster with the New Smart Object Operator Shortcut

Some PHP operators (e.g. ->, ::) can be quite a challenge for people who are used to different languages (like Java or C#). The new Zend Studio release introduces a new shortcut that will help developers work with: Object Operator (->) and Scope Resolution Operator (::), also called Paamayim Nekudotayim. To use it just press CTRL + . (dot) in place where you want to put one of the operators. Studio will detect actual context and will put proper version of operator into source code e.g. (| is a place where shortcut was triggered):

  • $myObject| will become $myObject->
  • MyClass| will become MyClass::

This functionality will also complete unfinished operator:

  • $myObject-| will become $myObject->
  • MyClass:| will become MyClass::

Of course, if you want to change the default keys combination, you can do it also very easily. Just go to Window -> Preferences -> General -> Keys and search for Create Object Operator entry. Now type your combination in the Binding field.

This functionality should help many developers that are switching between languages every day, but also those whose main language is PHP. Simple and handy.