summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_004.phpt
blob: 2df693aa997c8a6a1c7d22e23ededa6e810f928b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--TEST--
Test typed properties error condition (type mismatch)
--FILE--
<?php
new class("PHP 7 is better than you, and it knows it ...") {
	public int $int;

	public function __construct(string $string) {
		$this->int = $string;
	}
};
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous::$int of type int in %s:%d
Stack trace:
#0 %s(%d): class@anonymous->__construct('PHP 7 is better...')
#1 {main}
  thrown in %s on line %d