如果您嘗試在指定必要參數之前指定選用參數來取得所有方法/函式,請嘗試使用此正規表達式(單行)
<?php
function\s+[a-z][a-zA-Z0-9_]*\((?:\$[a-z][a-zA-Z0-9]*\s*,\s*)*
(?:\$[a-z][A-Za-z0-9_]*\s*=[^\$\)]+)+\$[a-z][a-zA-Z0-9_]*\)
?>
適用於
<?php
public function test($a, $b) {
$a = [];
$b = [$abc => $ss[],
];
}
private function too($c, $a = true, $b) {
}
protected function bar($a = []) {
}
public function foo($a, $b = true) {
}
public function fooBar32($a=true, $b = [], $c) {
}
private function oo_bAr($a = []) {
}
?>
它會匹配 too() 和 fooBar32()
祝您遷移順利! ;)