Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ReflectionCaster.php

function ReflectionCaster::castReflectionGenerator

1 call to ReflectionCaster::castReflectionGenerator()
ReflectionCaster::castGenerator in vendor/symfony/var-dumper/Caster/ReflectionCaster.php

File

vendor/symfony/var-dumper/Caster/ReflectionCaster.php, line 133

Class

ReflectionCaster
Casts Reflector related classes to array representation.

Namespace

Symfony\Component\VarDumper\Caster

Code

public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested) : array {
    $prefix = Caster::PREFIX_VIRTUAL;
    if ($c->getThis()) {
        $a[$prefix . 'this'] = new CutStub($c->getThis());
    }
    $function = $c->getFunction();
    $frame = [
        'class' => $function->class ?? null,
        'type' => isset($function->class) ? $function->isStatic() ? '::' : '->' : null,
        'function' => $function->name,
        'file' => $c->getExecutingFile(),
        'line' => $c->getExecutingLine(),
    ];
    if ($trace = $c->getTrace(\DEBUG_BACKTRACE_IGNORE_ARGS)) {
        $function = new \ReflectionGenerator($c->getExecutingGenerator());
        array_unshift($trace, [
            'function' => 'yield',
            'file' => $function->getExecutingFile(),
            'line' => $function->getExecutingLine(),
        ]);
        $trace[] = $frame;
        $a[$prefix . 'trace'] = new TraceStub($trace, false, 0, -1, -1);
    }
    else {
        $function = new FrameStub($frame, false, true);
        $function = ExceptionCaster::castFrameStub($function, [], $function, true);
        $a[$prefix . 'executing'] = $function[$prefix . 'src'];
    }
    $a[Caster::PREFIX_VIRTUAL . 'closed'] = false;
    return $a;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal