diff options
Diffstat (limited to 'tests/classes/constants_visibility_004.phpt')
| -rw-r--r-- | tests/classes/constants_visibility_004.phpt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/classes/constants_visibility_004.phpt b/tests/classes/constants_visibility_004.phpt new file mode 100644 index 0000000000..93acacf3c9 --- /dev/null +++ b/tests/classes/constants_visibility_004.phpt @@ -0,0 +1,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 class constant 'Z' in %s:11 +Stack trace: +#0 %s(15): B::checkConstants() +#1 {main} + thrown in %s on line 11 |
