summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/generator_closure_with_this.phpt
blob: d5a4861e804610bdf3364bf8d5a01a09bd4006e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Non-static closures can be generators
--FILE--
<?php

class Test {
    public function getGenFactory() {
        return function() {
            yield $this;
        };
    }
}

$genFactory = (new Test)->getGenFactory();
var_dump($genFactory()->current());

?>
--EXPECT--
object(Test)#1 (0) {
}