feature #32026 [VarDumper] caster for HttpClient's response dumps all info (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[VarDumper] caster for HttpClient's response dumps all info
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
No need to dump the internal structure for responses IMHO, here is a caster that dumps the info instead:
![image](https://user-images.githubusercontent.com/243674/59434490-efb5a280-8deb-11e9-8714-5f1ccbc208b1.png)
Commits
-------
2b268379f5
[VarDumper] caster for HttpClient's response dumps all info
This commit is contained in:
commit
bad18dc4ac
@ -48,4 +48,16 @@ class SymfonyCaster
|
|||||||
|
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)
|
||||||
|
{
|
||||||
|
$stub->cut += \count($a);
|
||||||
|
$a = [];
|
||||||
|
|
||||||
|
foreach ($response->getInfo() + ['debug' => $response->getInfo('debug')] as $k => $v) {
|
||||||
|
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,8 @@ abstract class AbstractCloner implements ClonerInterface
|
|||||||
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||||
'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
||||||
'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
||||||
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
|
||||||
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
|
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
|
||||||
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
|
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
|
||||||
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
|
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
|
||||||
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
|
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
|
||||||
|
Reference in New Issue
Block a user