summaryrefslogtreecommitdiff
path: root/tests/classes/constants_visibility_004.phpt
blob: 3872bc2829d0944a9604cca1f007933104ea23cc (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
--TEST--
Only public and protected class constants should be inherited
--FILE--
<?php
class A {
    public const X = 1;
    protected const Y = 2;
    private const Z = 3;
}
class B extends A {
    static public function checkConstants() {
        var_dump(self::X);
        var_dump(self::Y);
        var_dump(self::Z);
    }
}

B::checkConstants();
?>
--EXPECTF--
int(1)
int(2)

Fatal error: Uncaught Error: Undefined constant B::Z in %s:%d
Stack trace:
#0 %s(15): B::checkConstants()
#1 {main}
  thrown in %s on line 11