Michael Arrison
Michael Arrison

Reputation: 1553

PhpStorm: Find usage of function that includes parameter

If I have a function like this:

<?php

function foo($used, $maybe_unused = '') { ... }

Alt-F7 will find ALL calls to foo(). However, I want to find out if any of the calls include the second parameter or not. If none of the calls include the second parameter, I'll know it's safe to remove. Without looking through the entire list of results, I want to know if there are any calls like this:

foo('first', 'second');

or, if they are all like this:

foo('first');

and therefore I can remove the second parameter.

Upvotes: 8

Views: 1466

Answers (1)

duck_in_hat
duck_in_hat

Reputation: 252

You may want to use the Structural Search feature:
https://www.jetbrains.com/help/phpstorm/structural-search-and-replace.html

Moreover, there is an existing template named "Function call with 2 parameters" that should do the trick in your scenario. The only thing you will have to edit there is $a$ variable, just put your function name as a filter > text.

Hope it helps!

Upvotes: 5

Related Questions