fix(aot): 修复变量类型检查逻辑并更新测试用例

- 移除多余的变量类型验证检查逻辑
- 更新测试用例中的类型注解以匹配实际实现
- 修正 EsmtpTransport 类型在配置方法中的使用
pull/1/head
韩天峰 4 months ago
parent ea462010d1
commit 519ad7b292
  1. 4
      src/Php/CompilerBase.php
  2. 2
      tests/aot/type_hits/005.phpt

@ -5323,10 +5323,6 @@ class CompilerBase extends \PhpAot\Core\Translator
{
if (!$this->hasVar($name)) {
$this->addLocalVar($name, $defaultType);
} elseif ($defaultType === self::TYPE_VAR) {
if ($this->getVarType($name) !== self::TYPE_VAR) {
$this->fatalError($node, 'Cannot assign value to variable $' . $name . ' of type ' . $this->getVarType($name));
}
} else {
if ($this->getVarType($name) !== $defaultType) {
$this->fatalError($node, 'Cannot assign value to variable $' . $name . ' of type ' . $this->getVarType($name) . ' with type ' . $defaultType);

@ -30,7 +30,7 @@ class Baz {
}
class FooB {
function configure(FooA $o) {
function configure(EsmtpTransport $o) {
$o->send('Hello World', 'foo@bar');
}
}

Loading…
Cancel
Save