#28 Variable Name Suggestions

code, live templates, suggestions

Variable Name Suggestions

When writing foreach loops, PhpStorm will suggest a suitable variable name for the array item based on the name of the array. So if your array is called $items PhpStorm will suggest $item, the singular form of items.

PhpStorm is even smart enough to work out the singular form of words like people, octopi and oxen; I have yet to catch it out.

Bonus

You can use this feature in custom live templates by incorporating the phpSuggestVariableName expression function in your live template variables.

Further Reading

Related Tips

Blog Comments powered by Disqus.