summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_030.phpt
blob: a835ae5fae790ddc029f945ac909d948a5b95e04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Test typed properties unset __get magical magic
--FILE--
<?php
class Foo {
	public int $bar;

	public function __get($name) {
		return "violate";
	}
}

$foo = new Foo;

$foo->bar = "1"; # ok

unset($foo->bar); # ok

var_dump($foo->bar); # not okay, __get is nasty
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, string used in %s:16
Stack trace:
#0 {main}
  thrown in %s on line 16