xref: /PHP-8.3/ext/reflection/tests/001.phpt (revision 4f892118)
1--TEST--
2Reflection inheritance
3--FILE--
4<?php
5
6class ReflectionClassEx extends ReflectionClass
7{
8    public $bla;
9
10    function getMethodNames()
11    {
12        $res = array();
13        foreach($this->getMethods() as $m)
14        {
15            $res[] = $m->class . '::' . $m->name;
16        }
17        return $res;
18    }
19}
20
21$r = new ReflectionClassEx('ReflectionClassEx');
22
23$exp = array (
24  'UMLClass::__clone',
25  'UMLClass::__construct',
26  'UMLClass::__toString',
27  'UMLClass::getName',
28  'UMLClass::isInternal',
29  'UMLClass::isUserDefined',
30  'UMLClass::isInstantiable',
31  'UMLClass::getFileName',
32  'UMLClass::getStartLine',
33  'UMLClass::getEndLine',
34  'UMLClass::getDocComment',
35  'UMLClass::getConstructor',
36  'UMLClass::getMethod',
37  'UMLClass::getMethods',
38  'UMLClass::getProperty',
39  'UMLClass::getProperties',
40  'UMLClass::getConstants',
41  'UMLClass::getConstant',
42  'UMLClass::getInterfaces',
43  'UMLClass::isInterface',
44  'UMLClass::isAbstract',
45  'UMLClass::isFinal',
46  'UMLClass::getModifiers',
47  'UMLClass::isInstance',
48  'UMLClass::newInstance',
49  'UMLClass::getParentClass',
50  'UMLClass::isSubclassOf',
51  'UMLClass::getStaticProperties',
52  'UMLClass::getDefaultProperties',
53  'UMLClass::isIterateable',
54  'UMLClass::implementsInterface',
55  'UMLClass::getExtension',
56  'UMLClass::getExtensionName');
57
58$miss = array();
59
60$res = $r->getMethodNames();
61
62foreach($exp as $m)
63{
64    if (!in_array($m, $exp))
65    {
66        $miss[] = $m;
67    }
68}
69
70var_dump($miss);
71
72$props = array_keys(get_class_vars('ReflectionClassEx'));
73sort($props);
74var_dump($props);
75var_dump($r->name);
76?>
77--EXPECT--
78array(0) {
79}
80array(2) {
81  [0]=>
82  string(3) "bla"
83  [1]=>
84  string(4) "name"
85}
86string(17) "ReflectionClassEx"
87