1--TEST-- 2Test typed properties binary assign op helper test 3--FILE-- 4<?php 5declare(strict_types=1); 6 7class Foo { 8 public int $bar = 0; 9 10 public function __construct() { 11 $this->bar += 2; 12 try { 13 $this->bar += 1.5; 14 } catch (TypeError $e) { 15 echo $e->getMessage(), "\n"; 16 } 17 } 18} 19 20$foo = new Foo(); 21 22var_dump($foo->bar); 23?> 24--EXPECT-- 25Typed property Foo::$bar must be int, float used 26int(2) 27