diff --git a/examples/error/count-array.php b/examples/error/count-array.php new file mode 100644 index 00000000..2810580a --- /dev/null +++ b/examples/error/count-array.php @@ -0,0 +1,30 @@ +array = $array; + } +} + +class Bar +{ + public function run(array $array) + { + $n = count($array); + var_dump($n); + } +} + +function main() +{ + $bar = new Bar(); + + $foo = new FooArray([1, 2, 3]); + + $bar->run($foo->array); + +} \ No newline at end of file diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 918889b7..cd92b7b4 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -3405,7 +3405,7 @@ class CompilerBase extends \PhpAot\Core\Translator $list_args[] = $this->parseArg($arg); } - return '{' . implode(', ', $list_args) . '}'; + return Symbol::argList() . '{' . implode(', ', $list_args) . '}'; } /** diff --git a/src/Php/Symbol.php b/src/Php/Symbol.php index df5d3200..f033520d 100644 --- a/src/Php/Symbol.php +++ b/src/Php/Symbol.php @@ -49,4 +49,9 @@ class Symbol { return 'php::getClassEntrySafe'; } + + public static function argList(): string + { + return 'php::ArgList'; + } }