在PhpStorm中搜索未使用(从未传递)的方法参数?

在PhpStorm中搜索未使用(从未传递)的方法参数?,php,regex,phpstorm,Php,Regex,Phpstorm,我想重构一个方法。我想知道方法“myMethod”是否有未使用的参数。例如: <?php class myClass { public static function myMethod($p1 = false, $p2 = false, $p3 = false) { } } myClass::myMethod(true, true); myClass::myMethod(true); myClass::myMethod( true, true ); myCla

我想重构一个方法。我想知道方法“myMethod”是否有未使用的参数。例如:

<?php

class myClass {
    public static function myMethod($p1 = false, $p2 = false, $p3 = false) {

    }
}

myClass::myMethod(true, true);
myClass::myMethod(true);
myClass::myMethod(
  true,
  true
);
myClass::myMethod(true, true, true); // <= I want to find this..
myClass::myMethod(
  true, 
  true, 
  true); // <= ..i want also to find this..
myClass::myMethod(
  true,
  true,
  ['123', true, false, 'whatever']); // <= ..and I want also to find this..

我认为这能胜任这项工作

myMethod\([\s\S].*,[\s\S].*,[\s\S].*\);
它与“代码气味”一起工作

代码>按名称运行检验>“参数不匹配”:-)


什么是“未使用的参数”?前两个,
(true)
(true,true)
不是具有未使用参数的吗?我想知道代码中是否存在参数为$p3的方法调用,或者PHPStorm无法搜索方法用法。。因此,您可以获得使用此方法的所有位置的列表,并逐一浏览每个位置。除此之外,还有结构性搜索。。但它可能很难使用(我自己对此没有任何实际经验)。我有使用搜索的经验。这很好,但是在我的视图中没有特定参数用法的选项。我认为正则表达式是“最后”的选项Cyclass::myMethod(true、['123',true、false、'whatever']);//虽然这个代码片段可以解决这个问题,但它确实有助于提高文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。