diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 5bc86f36..cc501344 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -696,8 +696,6 @@ class CompilerBase extends \PhpAot\Core\Translator /** * 函数名称处理,补齐 namespace - * @param string $funcName - * @return string */ public function getNamespacedFuncName(string $funcName): string { @@ -710,7 +708,7 @@ class CompilerBase extends \PhpAot\Core\Translator return $funcName; } - protected function getObjectPropVarName(string $object, string $prop): string + protected function getObjectPropVarName(string $object, string $prop): string { return self::OBJECT_PROP . $object . self::NAMESPACE_SEPARATOR . $prop; } @@ -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 diff --git a/src/Php/Translator.php b/src/Php/Translator.php index 2721399c..adc62124 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -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');