ReflectionGenerator::getExecutingFile
PHP function
Edit on GitHub ✎
(PHP 7, PHP 8)
Gets the file name of the currently executing generator
Description
ReflectionGenerator::getExecutingFile(): string
Get the full path and file name of the currently executing generator.
Parameters Parameters
Return Values
Returns the full path and file name of the currently executing generator.
Examples
ReflectionGenerator::getExecutingFile example
php
<?php
class GenExample
{
public function gen()
{
yield 1;
}
}
$gen = (new GenExample)->gen();
$reflectionGen = new ReflectionGenerator($gen);
echo "File: {$reflectionGen->getExecutingFile()}";The above example will output something similar to:
output
File: /path/to/file/example.phpSee Also
ReflectionGenerator::getExecutingLineReflectionGenerator::getExecutingGenerator