New in PhpStorm 2017.1 – Parameter Hints

Brand new in 2017.1, we introduce parameter hints to make your code more readable and easier to understand.

PhpStorm 2017.1 now gives you a hint on the parameter name if the parameter is a literal or null:

parameter-hints

Notice how you now get the name of the variable you need to pass into a function or method when you call it. This makes understanding what you should be passing much more obvious (assuming you’ve named your parameters something reasonable!).

You can style these parameter hints in the settings; go to Editor | Colors and Fonts | Language Defaults and then select Inline parameter hints. Or you can turn the hints off altogether, by navigating to Editor | General | Appearance and deselecting Show parameter name hints. In the same area, you can configure which methods or functions should be blacklisted and never show parameter hints. An easier way to configure this is to use the Quickfix intention (default Alt+Enter), and then select Do not show hints for current method.

I’ve been using these hints since the earliest EAP for 2017.1 and I’ve grown to love them – give them a try and let us know what you think.

– Gary & The PhpStorm Team

About Gary Hockin

Gary Hockin has been creating code to power web applications for 15 years, the last three of them at an extraordinary level. He is handsome, talented, funny and articulate, and also extremely modest. Gary is a valued contributor to Zend Framework 2 and is a member of the community review team. He's married and has two wonderful children, and when he's not coding, writing about code, speaking about code or reading about code, he can usually be found in the pub playing pool.
This entry was posted in Cool Feature, Newsletter. Bookmark the permalink.
  • Seb Schuh

    I agree they are generally helpful… where I do not like them is whenever a function call has multiple parameters and every parameter is on its own line… method hints on some of those parameters makes it hard to see wether the indentation is correct and it looks weird as well.

  • gskema

    Hmm this would be very helpful for something like Symfony’s `new Cookie(…)` constructor. For everyday functions with 1-3 arguments – not so sure (yet).

    • Denis Kazimirov

      If you start to work with some legacy project with tons of code, it can be very very helpful. I think it is very nice to have this option and filter what you don’t need to see.

  • Peter Spegel

    It would be very nice to be able to toggle the parameter hints (globally) with some keyboard shortcut.

    • Eugene Morozov

      An action for that is already available in the Keymap, feel free to assign a shortcut.

  • El KuKu

    I’ve also grown to love them (EAP user).
    BUT – I believe that you should add a note about the possibility to define a keyboard shortcut to toggle them 😉

    • Eugene Morozov

      The action is called Parameter name hints, please check the Keymap.

  • Jan Kuchař

    I used them for early beginning and I really love them. Only thing that seems weird to me is when you make code temporarily invalid, all hints collapses and when you make code valid again it bounces back. This feel strange to me, despite I know it is nearly impossible to do something about it.

  • Ben
  • Carls

    Would love to see this work with other types of parameters, not only literals.

  • Ben

    This is awesome – is there a way to show the hints when a variable is being passed?

    https://uploads.disquscdn.com/images/56fff7c3343cb32677d3315ef6c944f8a07edfcf484ecc14d960fffe6c6d90d7.png

    • http://jatinsoni.rocks Jatin Soni

      I too want to know this. Also not showing hint if we pass array directly in the argument.

    • Thomas Nilton de Carvalho Vani

      I too want this..

  • matsand

    In general I like this new feature.
    Unfortunately I found it very straining on my eyes since they appear quite blurry and I felt my eyes trying to focus on the blur. I’m on a 4K monitor with 125% HiDPI setting in Windows 10. After a couple of minutes I turned it off – too annoying.

    • matsand

      Tried removing the background and they look good in the Settings window, but back out in the editor they have the still have background. Bug?

  • http://jatinsoni.rocks Jatin Soni

    I Love this feature. Just fantastic… but want to learn how can I use it for custom methods and functions. I wish this to works with variable too.

  • Victor Andreas

    It would be nice if there’s a setting to show the hint on focus of the function and hide on blur and toggle ALL hints with a keyboard shortcut.
    Also the background doesn’t appear in Language specific background-color.

    • unloco mqx

      not sure but search for “hint” in the keymap panel

  • http://blog.piotrows.pl/ Łukasz Piotrowski

    Is there a way to show hints to PHP std functions like in_array(), explode() etc?

  • Ewan McRobert

    I like the feature, though I think it looks a bit clunky with a background and too much like something I can edit without a background.

    In the settings there is an option to make it italic, which I’d like to do, but it doesn’t seem to actually do anything

  • Łza Włóczynutka

    https://uploads.disquscdn.com/images/06a959557c97e9068ec55afb48dca7ecf486fff8ac4e136e71a644ac45ce40a5.png How to change background or font color? Hints are unreadable with my color scheme :-(

    • Alex

      You can style these parameter hints in the settings; go to Editor | Colors and Fonts | Language Defaults and then select Inline parameter hints.

  • Andrew

    I don’t know if it useful , in my view the width between brackets getting wider, maybe better to have an event for viewing it