refactor(php): 更新 shell_exec 解析方法的参数类型

- 将 parseShellExec 方法的参数类型从 mixed 更改为 Node\Expr\ShellExec
- 重构 shell_exec 表达式的解析逻辑
- 使用 identifierToStr 方法处理表达式部分
- 改进代码的类型安全性和可读性
pull/1/head
韩天峰 5 months ago
parent e7db0c7348
commit 08cbfa1d71
  1. 8
      src/Php/CompilerBase.php

@ -4234,9 +4234,13 @@ class CompilerBase extends \PhpAot\Core\Translator
return $code;
}
protected function parseShellExec(mixed $expr): string
protected function parseShellExec(Node\Expr\ShellExec $expr): string
{
return 'php::call("shell_exec", {' . $this->parseInterpolatedString($expr) . '})';
$list = [];
foreach($expr->parts as $part) {
$list[] = $this->identifierToStr($part);
}
return 'php::shell_exec(php::concat({' . implode(', ', $list) . '}))';
}
protected function parseGoto(Node\Stmt\Goto_ $v): string

Loading…
Cancel
Save