1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/closures/closure_068.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

28 lines
750 B
PHP

--TEST--
ReflectionFunction::get{Short,Namespace}Name() and inNamespace() return the correct data for first class callables defined in namespaces.
--FILE--
<?php
namespace Foo;
function foo() {
}
$r = new \ReflectionFunction(foo(...));
$r2 = new \ReflectionFunction('Foo\\foo');
var_dump($r->getShortName());
var_dump($r->getNamespaceName());
var_dump($r->inNamespace());
var_dump($r->getNamespaceName() . ($r->inNamespace() ? '\\' : '') . $r->getShortName() === $r->getName());
var_dump($r->getShortName() === $r2->getShortName());
var_dump($r->getNamespaceName() === $r2->getNamespaceName());
var_dump($r->inNamespace() === $r2->inNamespace());
?>
--EXPECT--
string(3) "foo"
string(3) "Foo"
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)