1--TEST-- 2Demonstrate that cache_slot optimization is illegal due to cache_slot merging 3--FILE-- 4<?php 5 6class Test { 7 public int $prop; 8 9 public function method() { 10 // Opcache merges cache slots for both assignments. 11 $this->prop = 1; 12 try { 13 $this->prop = "foobar"; 14 } catch (TypeError $e) { 15 echo $e->getMessage(), "\n"; 16 } 17 var_dump($this->prop); 18 } 19} 20 21$test = new Test; 22$test->method(); 23$test->method(); 24 25?> 26--EXPECT-- 27Typed property Test::$prop must be int, string used 28int(1) 29Typed property Test::$prop must be int, string used 30int(1) 31