xref: /PHP-8.4/Zend/tests/closure_068.phpt (revision a1cc0918)
1--TEST--
2ReflectionFunction::get{Short,Namespace}Name() and inNamespace() return the correct data for first class callables defined in namespaces.
3--FILE--
4<?php
5namespace Foo;
6
7function foo() {
8}
9$r = new \ReflectionFunction(foo(...));
10$r2 = new \ReflectionFunction('Foo\\foo');
11var_dump($r->getShortName());
12var_dump($r->getNamespaceName());
13var_dump($r->inNamespace());
14var_dump($r->getNamespaceName() . ($r->inNamespace() ? '\\' : '') . $r->getShortName() === $r->getName());
15
16var_dump($r->getShortName() === $r2->getShortName());
17var_dump($r->getNamespaceName() === $r2->getNamespaceName());
18var_dump($r->inNamespace() === $r2->inNamespace());
19?>
20--EXPECT--
21string(3) "foo"
22string(3) "Foo"
23bool(true)
24bool(true)
25bool(true)
26bool(true)
27bool(true)
28