1--TEST-- 2Test typed static property with assign op operators 3--FILE-- 4<?php 5function &stringRef() { 6 static $a = "1"; 7 $b = $a; 8 $a = &$b; 9 return $a; 10} 11 12class Foo { 13 public static int $i = 0; 14 public static string $s = "1"; 15} 16 17Foo::$s .= "1"; 18var_dump(Foo::$s); 19 20Foo::$s += 2; 21var_dump(Foo::$s); 22 23Foo::$s = &stringRef(); 24Foo::$s .= 2; 25var_dump(Foo::$s); 26 27Foo::$i += stringRef(); 28var_dump(Foo::$i); 29 30try { 31 Foo::$i += PHP_INT_MAX; 32} catch (TypeError $e) { print $e->getMessage()."\n"; } 33var_dump(Foo::$i); 34 35try { 36 Foo::$i .= PHP_INT_MAX; 37} catch (TypeError $e) { print $e->getMessage()."\n"; } 38var_dump(Foo::$i); 39 40?> 41--EXPECT-- 42string(2) "11" 43string(2) "13" 44string(2) "12" 45int(1) 46Cannot assign float to property Foo::$i of type int 47int(1) 48Cannot assign string to property Foo::$i of type int 49int(1) 50