1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/tests/classes/constants_visibility_002.phpt
2020-02-03 22:52:20 +01:00

28 lines
549 B
PHP

--TEST--
Class protected constant visibility
--FILE--
<?php
class A {
protected const protectedConst = 'protectedConst';
static function staticConstDump() {
var_dump(self::protectedConst);
}
function constDump() {
var_dump(self::protectedConst);
}
}
A::staticConstDump();
(new A())->constDump();
try {
constant('A::protectedConst');
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
string(14) "protectedConst"
string(14) "protectedConst"
Cannot access protected const A::protectedConst