summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_004.phpt
blob: 03d9e41aac4739732252068ea5b7a904683a45ff (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: Typed property class@anonymous::$int must be int, string used in %s:6
Stack trace:
#0 %s(2): class@anonymous->__construct('PHP 7 is better...')
#1 {main}
  thrown in %s on line 6