summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_002.phpt
blob: b0d1e1c0f2795bfc2f90f35964dbde172a765eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--TEST--
Test typed properties error condition (read uninitialized)
--FILE--
<?php
$thing = new class() {
    public int $int;
};

var_dump($thing->int);
?>
--EXPECTF--
Fatal error: Uncaught Error: Typed property class@anonymous::$int must not be accessed before initialization in %s:6
Stack trace:
#0 {main}
  thrown in %s on line 6