1--TEST-- 2GH-12482: Invalid type inference 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.jit_hot_func=2 7--FILE-- 8<?php 9trait T { 10 function foo() { 11 $cloned = clone $this; 12 $cloned->x = 42; 13 return $cloned; 14 } 15} 16class A { 17 use T; 18 public $a = 1; 19 public $b = 2; 20 public $c = 3; 21 public $x = 4; 22} 23class B { 24 use T; 25 public $x = 5; 26} 27$a = new A; 28var_dump($a->foo()); 29var_dump($a->foo()); 30$b = new B; 31var_dump($b->foo()); 32?> 33--EXPECT-- 34object(A)#2 (4) { 35 ["a"]=> 36 int(1) 37 ["b"]=> 38 int(2) 39 ["c"]=> 40 int(3) 41 ["x"]=> 42 int(42) 43} 44object(A)#2 (4) { 45 ["a"]=> 46 int(1) 47 ["b"]=> 48 int(2) 49 ["c"]=> 50 int(3) 51 ["x"]=> 52 int(42) 53} 54object(B)#3 (1) { 55 ["x"]=> 56 int(42) 57} 58