summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_080.phpt
blob: 58a17a1a965f8687852ea67b619541e4be5a9384 (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
28
29
30
31
32
33
34
35
36
--TEST--
Access to typed static properties before initialization
--FILE--
<?php

class Test {
    public static int $a;
    protected static int $b;
    private static int $c;

    static function run() {
        try {
            self::$a;
        } catch (Error $e) {
            echo $e->getMessage(), "\n";
        }
        try {
            self::$b;
        } catch (Error $e) {
            echo $e->getMessage(), "\n";
        }
        try {
            self::$c;
        } catch (Error $e) {
            echo $e->getMessage(), "\n";
        }
    }
}

Test::run();

?>
--EXPECT--
Typed static property Test::$a must not be accessed before initialization
Typed static property Test::$b must not be accessed before initialization
Typed static property Test::$c must not be accessed before initialization