1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/Zend/tests/access_modifiers/access_modifiers_009.phpt
DanielEScherzer 8475d5fea1 Zend/tests: organize some tests with subdirectories (#15638)
Move some low-hanging fruit, creating new directories for the tests for

* access modifiers
* `class_alias()`
* constant expressions
* constructor property promotion
* `__debugInfo()`
* dereferencing
* first class callable syntax

Additionally, move some tests into the existing subdirectory for
closure-related tests

Work towards GH-15631
2024-10-13 14:21:07 +01:00

59 lines
1.1 KiB
PHP

--TEST--
Inconsistencies when accessing protected members - is_callable
--FILE--
<?php
class A {
static protected function ma() {
return 'A::ma()';
}
static private function mp() {
return 'A::mp()';
}
}
class B1 extends A {
static protected function ma() {
return 'B1::ma()';
}
static protected function mp() {
return 'B1::mp()';
}
static protected function mb() {
return 'B1::mb()';
}
}
class B2 extends A {
static public function test() {
var_dump(is_callable('A::ma'));
var_dump(is_callable('A::mp'));
var_dump(is_callable('B1::ma')); // protected method defined also in A
var_dump(is_callable('B1::mp')); // protected method defined also in A but as private
var_dump(is_callable('B1::mb'));
}
}
var_dump(is_callable('B2::ma'));
var_dump(is_callable('B2::mp'));
var_dump(is_callable('B2::mb'));
var_dump(is_callable('B2::test'));
echo '----' . "\n";
B2::test();
?>
--EXPECT--
bool(false)
bool(false)
bool(false)
bool(true)
----
bool(true)
bool(false)
bool(true)
bool(false)
bool(false)