我正在为我们的插件开发PHP7兼容性,并注意到使用以下代码时它运行正常,没有警告或错误:
foreach ( $form_inputs as $order => $input_field ) {
$name = ucwords( str_replace( '_', ' ', $input_field['template'] ) );
Give_FFM_Admin_Template::{$input_field['template']}( $count, $name, $input_field );
$count ++;
}
然而,PHPStorm并不喜欢括号:
我使用了以下推荐的语法:PHP7 method_exists Uncaught Error: Function name must be a string
非常感谢任何见解!