Gets the executing Generator object

# ReflectionGenerator::getExecutingGenerator

(PHP 7)

ReflectionGenerator::getExecutingGenerator — Gets the executing Generator object

### 説明

public ReflectionGenerator::getExecutingGenerator ( void ) : Generator

Get the executing Generator object

### パラメータ

この関数にはパラメータはありません。

### 返り値

Returns the currently executing Generator object.

### 例

例1 ReflectionGenerator::getExecutingGenerator() example

`<?php
class GenExample
{
public function gen()
{
yield 1;
}
}
$gen = (new GenExample)->gen();
$reflectionGen = new ReflectionGenerator($gen);
$gen2 = $reflectionGen->getExecutingGenerator();
var_dump($gen2 === $gen);
var_dump($gen2->current());`

上の例の出力は、 たとえば以下のようになります。

    bool(true)
    int(1);

### 参考

- ReflectionGenerator::getExecutingLine() - Gets the currently executing line of the generator
- ReflectionGenerator::getExecutingFile() - Gets the file name of the currently executing generator