简体   繁体   English

PhpStorm:查找包含参数的 function 的用法

[英]PhpStorm: Find usage of function that includes parameter

If I have a function like this:如果我有这样的 function:

<?php

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

Alt-F7 will find ALL calls to foo(). Alt-F7将查找对 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.因此我可以删除第二个参数。

You may want to use the Structural Search feature:您可能想要使用结构搜索功能:
https://www.jetbrains.com/help/phpstorm/structural-search-and-replace.html 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.此外,有一个名为“具有 2 个参数的函数调用”的现有模板应该可以在您的场景中发挥作用。 The only thing you will have to edit there is $a$ variable, just put your function name as a filter > text.您唯一需要编辑的是 $a$ 变量,只需将您的 function 名称作为过滤器 > 文本。

Hope it helps!希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM