Easily find specific code usages in PhpStorm without regex


Let's continue the theme from the previous tip about tightening up our Laravel view assertions in our tests.

So now that you know that assertViewHas isn't working the way you might expect with null values, how can you find all the locations in your tests that need refactoring?

In PHPStorm, you can use Shift-Cmd-F (or the equivalent in your OS) to "find in all files" and easily find all mentions of the assertViewHas helper, but you might think you need to do a fancy regular expression to limit results to only those that are asserting null values.

But there's an easier way! After doing your global Shift-Cmd-F, you can then click in the find results and use Cmd-F to find null just within your existing set of search results. No fancy regex needed!

Searching within PHPStorm search results

Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.