diff --git a/examples/obj.php b/examples/obj.php index 8b6e787a..b3890232 100644 --- a/examples/obj.php +++ b/examples/obj.php @@ -5,6 +5,12 @@ class Test public int $a; public int $b; + public function __construct(int $a, int $b) + { + $this->a = $a; + $this->b = $b; + } + public function test() { return $this->a + $this->b; @@ -13,9 +19,7 @@ class Test function main() { - $obj = new Test(); - $obj->a = 1; - $obj->b = 2; + $obj = new Test(1, 2); $arr = array(); $arr['obj'] = $obj; diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index fd382b53..3cf3ff7d 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -772,8 +772,6 @@ class CompilerBase extends \PhpAot\Core\Translator if ($left->getType() === self::EXPR_ARRAY_DIM_FETCH) { return $this->parseAssignArrayDim($left, $right); - } elseif ($left->getType() === 'Expr_PropertyFetch') { - return $this->parseAssignPropertyFetch($left, $right); } elseif ($left->getType() === 'Expr_StaticPropertyFetch') { $class = $this->identifierToStr($left->class); $propName = $this->identifierToStr($left->name);