Php/docs/reflectiongenerator.construct

提供:Dev Guides
< Php
移動先:案内検索

ReflectionGenerator::__construct

(PHP 7)

ReflectionGenerator::__constructReflectionGenerator オブジェクトを構築する


説明

public ReflectionGenerator::__construct ( Generator $generator )

ReflectionGenerator オブジェクトを構築します。


パラメータ

generator
ジェネレータオブジェクト


返り値

値を返しません。


例1 ReflectionGenerator::__construct() の例

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

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


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

参考