PhpStorm: Find usage of function that includes parameter
Asked Answered
C

1

8

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.

Chetnik answered 23/6, 2020 at 16:24 Comment(0)
T
5

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!

Tharp answered 23/6, 2020 at 21:25 Comment(1)
This could be a good answer with an example given. The feature certainly seems powerful though.Harmaning

© 2022 - 2024 — McMap. All rights reserved.