Skip to content

Commit 1be19de

Browse files
committed
[VarDumper] Added a support for casting RamseyUuid
1 parent 54ba699 commit 1be19de

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/Symfony/Component/VarDumper/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
to configure casters & flags to use in tests
99
* added `ImagineCaster` and infrastructure to dump images
1010
* added the stamps of a message after it is dispatched in `TraceableMessageBus` and `MessengerDataCollector` collected data
11+
* added `UuidCaster`
1112

1213
4.3.0
1314
-----
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\VarDumper\Caster;
13+
14+
use Imagine\Image\ImageInterface;
15+
use Ramsey\Uuid\UuidInterface;
16+
use Symfony\Component\VarDumper\Cloner\Stub;
17+
18+
/**
19+
* @author Grégoire Pineau <lyrixx@lyrixx.info>
20+
*/
21+
class UuidCaster
22+
{
23+
public static function castRamseyUuid(UuidInterface $c, array $a, Stub $stub, $isNested)
24+
{
25+
$a += [
26+
Caster::PREFIX_VIRTUAL.'uuid' => (string) $c,
27+
];
28+
29+
return $a;
30+
}
31+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ abstract class AbstractCloner implements ClonerInterface
8989

9090
'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'],
9191

92+
'Ramsey\Uuid\UuidInterface' => ['Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'],
93+
9294
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
9395
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
9496
'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy