1--TEST-- 2Non-static closures can be generators 3--FILE-- 4<?php 5 6class Test { 7 public function getGenFactory() { 8 return function() { 9 yield $this; 10 }; 11 } 12} 13 14$genFactory = (new Test)->getGenFactory(); 15var_dump($genFactory()->current()); 16 17?> 18--EXPECT-- 19object(Test)#1 (0) { 20} 21