feat(php): 添加对 $$ 语法的检测和错误提示

- 在变量表达式解析过程中添加对象类型检查
- 当遇到 $$ 语法时触发致命错误提示
- 阻止不支持的变量变量语法继续执行
- 提供明确的错误信息帮助开发者识别问题
pull/1/head
韩天峰 7 months ago
parent 96ecb8aae0
commit 8d8cb358d5
  1. 3
      src/Php/CompilerBase.php

@ -405,6 +405,9 @@ class CompilerBase extends \PhpAot\Core\Translator
$type = $expr->getType();
switch ($type) {
case self::EXPR_VARIABLE:
if (is_object($expr->name) and $this->isVarExpr($expr->name)) {
$this->fatalError($expr, 'The `$$` syntax is not supported');
}
return $this->escapeVarName($expr->name);
case 'Name':
case 'VarLikeIdentifier':

Loading…
Cancel
Save