CakeFest 2024: The Official CakePHP Conference

ReflectionGenerator::getExecutingLine

(PHP 7, PHP 8)

ReflectionGenerator::getExecutingLine現在実行中のジェネレータの行を取得する

説明

public ReflectionGenerator::getExecutingLine(): int

現在実行中のジェネレータの行を取得します。

パラメータ

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

戻り値

現在実行中のジェネレータの式の行番号を返します。

例1 ReflectionGenerator::getExecutingLine() の例

<?php

class GenExample
{
public function
gen()
{
yield
1;
}
}

$gen = (new GenExample)->gen();

$reflectionGen = new ReflectionGenerator($gen);

echo
"Line: {$reflectionGen->getExecutingLine()}";

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

Line: 7

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top