PHP 8.6.0 Beta 1 is available for testing

ReflectionGenerator::__construct

(PHP 7, PHP 8)

ReflectionGenerator::__constructConstruye un objeto ReflectionGenerator

Descripción

public function ReflectionGenerator::__construct(Generator $generator)

Construye un objeto ReflectionGenerator .

Parámetros

generator

Un objeto generator.

Ejemplos

Ejemplo #1 Ejemplo con ReflectionGenerator::__construct()

<?php
function gen()
{
 yield 1;
}
$gen = gen();
$reflectionGen = new ReflectionGenerator($gen);
echo <<< output
{$reflectionGen->getFunction()->name}
Line: {$reflectionGen->getExecutingLine()}
File: {$reflectionGen->getExecutingFile()}output;

Resultado del ejemplo anterior es similar a:

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

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /