How To Turn On Semantic Highlighting for PHP in PhpStorm

I have to be honest with you: semantic highlighting for PHP has changed my coding life.  I am very much spoiled by it now and you know what, I don’t mind at all.  There I said it.  I am definitely a code snob now and I am perfectly ok with it.  I am also much more efficient with my code since I can visually see the connections between different instances of a variable on the screen, all color coded and sweet looking, but before I get ahead of myself…

What is Semantic Highlighting?

Great question.  Let me show you rather than spend a bunch of time explaining it:

In short, “semantic highlighting” color codes variables based on their current instance within a method, function or file (depending on what you are working with).  As indicated in my screenshot, all of the $ranges variables are colored the same color green which makes it easier to keep track of that particular variable and it’s updates and changes throughout the code.  As you can see also in the screenshot, the other variables are color coded as well.  Imagine this kind of visual clarity across your whole PHP project… it’s glorious. 😍

That’s awesome but how do I do it?

Another great question.  Here’s how you enable “Semantic Highlighting” for PHP in PhpStorm: (I’ll show you first cuz that is faster)

For those who would rather read…

  1. Open the main Preferences / Settings screen
  2. Choose Editor -> Color Scheme -> PHP in the waterfall menu on the left
  3. Choose “Semantic Highlighting” from the list on the right
  4. Check the “Semantic Highlighting” box on the far right side above the list of colors
  5. Click Ok

That’s it!  You’re done.  Wasn’t that easy-peasy?

Now, with semantic highlighting enabled, you can enjoy a next level of awesomeness as your code takes on a whole new color-full (see what I did there 😉) life.

Happy coding!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.