pull/1/head
韩天峰 4 months ago
parent c4b7e3022a
commit 70d06eeb2b
  1. 12
      src/Php/CompilerBase.php
  2. 6
      src/Php/Translator.php

@ -696,8 +696,6 @@ class CompilerBase extends \PhpAot\Core\Translator
/**
* 函数名称处理,补齐 namespace
* @param string $funcName
* @return string
*/
public function getNamespacedFuncName(string $funcName): string
{
@ -3461,9 +3459,9 @@ class CompilerBase extends \PhpAot\Core\Translator
if ($object === 'this_' and $this->isIdExpr($var->name)) {
$propName = $this->parseIdentifier($var->name);
if ($this->hasObjectPropVar($this->getObjectPropVarName($object, $propName))) {
$this->warning($var, "Object property `$propName` of native types cannot be unset");
$this->warning($var, "Object property `{$propName}` of native types cannot be unset");
$lines = [];
$lines[] = $this->getObjectPropVarName($object, $propName) . " = 0;";
$lines[] = $this->getObjectPropVarName($object, $propName) . ' = 0;';
}
}
} elseif ($this->isVarExpr($var)) {
@ -3520,7 +3518,7 @@ class CompilerBase extends \PhpAot\Core\Translator
// TODO 分析对象是否为 SSA , 如果是 SSA 则可以将属性设置为引用
if ($expr->hasAttribute('nativePropertyDef') and $this->nativeTypes and $objectVar === 'this_') {
/**
* @var $def PropertyDef
* @var PropertyDef $def
*/
$def = $expr->getAttribute('nativePropertyDef');
if ($def->type === self::TYPE_INT or $def->type === self::TYPE_FLOAT) {
@ -4747,7 +4745,7 @@ class CompilerBase extends \PhpAot\Core\Translator
return true;
}
if (!$this->strictTypes) {
$this->warning($left, "Attempt to implicitly convert `$fromType` to `$toType`");
$this->warning($left, "Attempt to implicitly convert `{$fromType}` to `{$toType}`");
return true;
}
}
@ -4755,7 +4753,7 @@ class CompilerBase extends \PhpAot\Core\Translator
if ($this->isNativeType($toType) and $this->isNativeType($fromType)) {
return true;
}
$this->fatalError($left, "Cannot re-assign variable from `$fromType` to `$toType`");
$this->fatalError($left, "Cannot re-assign variable from `{$fromType}` to `{$toType}`");
}
protected function mustNoCall(NodeAbstract $node): void

@ -215,14 +215,14 @@ class Translator extends Preprocessor
{
$phpDir = shell_exec('php-config --prefix');
if (empty($phpDir)) {
$this->error("The `php-config` is not found");
$this->error('The `php-config` is not found');
}
$phpDir = trim($phpDir);
if (!is_file($phpDir . '/lib/libphp.so')) {
$this->error("The `libphp.so` is not found, please run `make` to build it");
$this->error('The `libphp.so` is not found, please run `make` to build it');
}
if (!is_file($this->getPhpxDir() . '/lib/libphpx.so')) {
$this->error("The `libphpx.so` is not found, please run `make` to build it");
$this->error('The `libphpx.so` is not found, please run `make` to build it');
}
$clangFormatVersion = shell_exec('clang-format --version');

Loading…
Cancel
Save