<?php class XABC { function foo() { // static does not apply to self $f = static function () : self { // __CLASS__ is preserved in the closure echo __CLASS__.PHP_EOL; return new self(); }; return $f; } } var_dump((new xabc)->foo()());
You have javascript disabled. You will not be able to edit any code.