diff --git a/Caster/ReflectionCaster.php b/Caster/ReflectionCaster.php index 8208cf74..45bd5e6d 100644 --- a/Caster/ReflectionCaster.php +++ b/Caster/ReflectionCaster.php @@ -80,10 +80,6 @@ public static function unsetClosureFileInfo(\Closure $c, array $a) public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested) { - if (!class_exists('ReflectionGenerator', false)) { - return $a; - } - // Cannot create ReflectionGenerator based on a terminated Generator try { $reflectionGenerator = new \ReflectionGenerator($c); @@ -136,9 +132,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a } else { $function = new FrameStub($frame, false, true); $function = ExceptionCaster::castFrameStub($function, [], $function, true); - $a[$prefix.'executing'] = new EnumStub([ - "\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'], - ]); + $a[$prefix.'executing'] = $function[$prefix.'src']; } $a[Caster::PREFIX_VIRTUAL.'closed'] = false; diff --git a/Tests/Caster/ReflectionCasterTest.php b/Tests/Caster/ReflectionCasterTest.php index a0b8e1d1..8c67d3a7 100644 --- a/Tests/Caster/ReflectionCasterTest.php +++ b/Tests/Caster/ReflectionCasterTest.php @@ -184,12 +184,11 @@ public function testGenerator() Generator { this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} executing: { - Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() { - %sGeneratorDemo.php:14 { - › { - › yield from bar(); - › } - } + %sGeneratorDemo.php:14 { + Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() + › { + › yield from bar(); + › } } } closed: false @@ -208,6 +207,7 @@ public function testGenerator() this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} trace: { %s%eTests%eFixtures%eGeneratorDemo.php:9 { + Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() › { › yield 1; › } @@ -219,12 +219,11 @@ public function testGenerator() } 1 => Generator { executing: { - Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() { - %sGeneratorDemo.php:10 { - › yield 1; - › } - › - } + %sGeneratorDemo.php:10 { + Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() + › yield 1; + › } + › } } closed: false