ReflectionGenerator::__construct

Constructs a ReflectionGenerator object

&reftitle.description; public `ReflectionGenerator::__construct` `Generator` `generator`

Constructs a `ReflectionGenerator` object.

&reftitle.parameters;

`generator`

- A generator object.

&reftitle.examples;

### `ReflectionGenerator::__construct` example

    <?php

    function gen()
    {
        yield 1;
    }

    $gen = gen();

    $reflectionGen = new ReflectionGenerator($gen);

    echo <<< output
    {$reflectionGen->getFunction()->name}
    Line: {$reflectionGen->getExecutingLine()}
    File: {$reflectionGen->getExecutingFile()}
    output;

&example.outputs.similar;

    gen
    Line: 5
    File: /path/to/file/example.php

&reftitle.seealso;

- `ReflectionGenerator::getFunction`
- `ReflectionGenerator::getExecutingLine`
- `ReflectionGenerator::getExecutingFile`