diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index f3da5c1f..2e8b6334 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -866,6 +866,12 @@ class CompilerBase extends \PhpAot\Core\Translator if (count($right->args) === 2 and $fn === 'objval' and $this->isScalarString($right->args[1]->value)) { $this->objects[$var] = $this->parseIdentifier($right->args[1]->value); $type = self::TYPE_OBJECT; + } elseif (count($right->args) === 1 and $fn === 'any') { + $type = self::TYPE_VAR; + if (!$this->hasVar($var)) { + $this->addLocalVar($var, $type); + } + return $var . ' = ' . $this->parseIdentifier($right->args[0]->value); } } diff --git a/src/Php/Constants.php b/src/Php/Constants.php index 1a556308..d3e0dd88 100644 --- a/src/Php/Constants.php +++ b/src/Php/Constants.php @@ -34,6 +34,7 @@ class Constants 'int', 'new', 'null', + 'var', 'or', 'and', 'private', diff --git a/tests/aot/any.phpt b/tests/aot/any.phpt new file mode 100644 index 00000000..76815d40 --- /dev/null +++ b/tests/aot/any.phpt @@ -0,0 +1,13 @@ +--TEST-- +any +--FILE-- + +--EXPECT-- +float(2.5)