Skip to content

Commit d36dd76

Browse files
[VarDumper] fix tests & displaying generators
1 parent 71bf18e commit d36dd76

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

Caster/ReflectionCaster.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ public static function unsetClosureFileInfo(\Closure $c, array $a)
8080

8181
public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
8282
{
83-
if (!class_exists('ReflectionGenerator', false)) {
84-
return $a;
85-
}
86-
8783
// Cannot create ReflectionGenerator based on a terminated Generator
8884
try {
8985
$reflectionGenerator = new \ReflectionGenerator($c);
@@ -136,9 +132,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a
136132
} else {
137133
$function = new FrameStub($frame, false, true);
138134
$function = ExceptionCaster::castFrameStub($function, [], $function, true);
139-
$a[$prefix.'executing'] = new EnumStub([
140-
"\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
141-
]);
135+
$a[$prefix.'executing'] = $function[$prefix.'src'];
142136
}
143137

144138
$a[Caster::PREFIX_VIRTUAL.'closed'] = false;

Tests/Caster/ReflectionCasterTest.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,11 @@ public function testGenerator()
184184
Generator {
185185
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
186186
executing: {
187-
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {
188-
%sGeneratorDemo.php:14 {
189-
› {
190-
› yield from bar();
191-
› }
192-
}
187+
%sGeneratorDemo.php:14 {
188+
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz()
189+
› {
190+
› yield from bar();
191+
› }
193192
}
194193
}
195194
closed: false
@@ -208,6 +207,7 @@ public function testGenerator()
208207
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
209208
trace: {
210209
%s%eTests%eFixtures%eGeneratorDemo.php:9 {
210+
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
211211
› {
212212
› yield 1;
213213
› }
@@ -219,12 +219,11 @@ public function testGenerator()
219219
}
220220
1 => Generator {
221221
executing: {
222-
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() {
223-
%sGeneratorDemo.php:10 {
224-
› yield 1;
225-
› }
226-
227-
}
222+
%sGeneratorDemo.php:10 {
223+
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
224+
› yield 1;
225+
› }
226+
228227
}
229228
}
230229
closed: false

0 commit comments

Comments
 (0)