1--TEST-- 2ReflectionFunction::get{Short,Namespace}Name() and inNamespace() return the correct data for closures defined in namespaces. 3--FILE-- 4<?php 5namespace Foo; 6 7class Bar { 8 public function baz() { 9 return function () { 10 11 }; 12 } 13} 14 15$c = (new Bar())->baz(); 16$r = new \ReflectionFunction($c); 17// Closures are not inside of a namespace, thus the short name is the full name. 18var_dump($r->getShortName()); 19// The namespace is empty. 20var_dump($r->getNamespaceName()); 21// The function is not inside of a namespace. 22var_dump($r->inNamespace()); 23// And the namespace name + the short name together must be the full name. 24var_dump($r->getNamespaceName() . ($r->inNamespace() ? '\\' : '') . $r->getShortName() === $r->getName()); 25?> 26--EXPECT-- 27string(26) "{closure:Foo\Bar::baz():6}" 28string(0) "" 29bool(false) 30bool(true) 31