summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_086.phpt
blob: c58eb7898efe1773faad90a6a6be172369002cf1 (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
26
27
--TEST--
Test typed properties with integer keys
--FILE--
<?php

class T {
	// Class must have at least one property. Property must have a type.
	// Empty class or untyped property removes segfault
	public int $i;
}

$t = new T;
// $x must be undefined or a non-string type
$x = 1;
$t->$x = 2;
$t->$x--;

var_dump($t);

?>
--EXPECT--
object(T)#1 (1) {
  ["i"]=>
  uninitialized(int)
  ["1"]=>
  int(1)
}