diff --git a/src/Symfony/Component/VarDumper/CHANGELOG.md b/src/Symfony/Component/VarDumper/CHANGELOG.md index 2172a3e644..bd57d799df 100644 --- a/src/Symfony/Component/VarDumper/CHANGELOG.md +++ b/src/Symfony/Component/VarDumper/CHANGELOG.md @@ -8,6 +8,7 @@ CHANGELOG to configure casters & flags to use in tests * added `ImagineCaster` and infrastructure to dump images * added the stamps of a message after it is dispatched in `TraceableMessageBus` and `MessengerDataCollector` collected data + * added `UuidCaster` 4.3.0 ----- diff --git a/src/Symfony/Component/VarDumper/Caster/ImagineCaster.php b/src/Symfony/Component/VarDumper/Caster/ImagineCaster.php index 10497cdac9..2275386ad4 100644 --- a/src/Symfony/Component/VarDumper/Caster/ImagineCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ImagineCaster.php @@ -19,7 +19,7 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class ImagineCaster { - public static function castImage(ImageInterface $c, array $a, Stub $stub, $isNested) + public static function castImage(ImageInterface $c, array $a, Stub $stub, bool $isNested): array { $imgData = $c->get('png'); if (\strlen($imgData) > 1 * 1000 * 1000) { diff --git a/src/Symfony/Component/VarDumper/Caster/UuidCaster.php b/src/Symfony/Component/VarDumper/Caster/UuidCaster.php new file mode 100644 index 0000000000..dd68c04223 --- /dev/null +++ b/src/Symfony/Component/VarDumper/Caster/UuidCaster.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Ramsey\Uuid\UuidInterface; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Grégoire Pineau + */ +class UuidCaster +{ + public static function castRamseyUuid(UuidInterface $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'uuid' => (string) $c, + ]; + + return $a; + } +} diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 6aec3e4924..fc7f20a2d0 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -89,6 +89,8 @@ abstract class AbstractCloner implements ClonerInterface 'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'], + 'Ramsey\Uuid\UuidInterface' => ['Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'], + 'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'], 'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], 'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],