Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59192b8

Browse files
[VarDumper] caster for HttpClient's response dumps all info
1 parent fa38497 commit 59192b8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Symfony/Component/VarDumper/Caster/SymfonyCaster.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,17 @@ public static function castHttpClient($client, array $a, Stub $stub, $isNested)
4848

4949
return $a;
5050
}
51+
52+
public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)
53+
{
54+
$stub->cut += \count($a);
55+
$a = [];
56+
57+
foreach ($response->getInfo() + ['debug' => $response->getInfo('debug')] as $k => $v) {
58+
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
59+
}
60+
61+
return $a;
62+
}
63+
5164
}

src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ abstract class AbstractCloner implements ClonerInterface
7878
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
7979
'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
8080
'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
81-
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
82-
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
81+
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
82+
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
8383
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
8484
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
8585
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],

0 commit comments

Comments
 (0)