1--TEST-- 2testing anon classes in functions outside of classes in namespaces 3--FILE-- 4<?php 5namespace lone { 6 function my_factory() { 7 return new class{}; 8 } 9 10 class Outer { 11 12 public function __construct() { 13 var_dump( 14 my_factory()); 15 } 16 } 17 18 new Outer(); 19} 20--EXPECTF-- 21object(class@%s)#2 (0) { 22} 23 24