upgraded dependencies

This commit is contained in:
RafficMohammed
2023-01-08 01:59:16 +05:30
parent 51056e3aad
commit f9ae387337
6895 changed files with 133617 additions and 178680 deletions

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 4.4
* @final
*/
class AmqpCaster
{
@@ -46,7 +46,7 @@ class AmqpCaster
\AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
];
public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)
public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -79,7 +79,7 @@ class AmqpCaster
return $a;
}
public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNested)
public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -102,7 +102,7 @@ class AmqpCaster
return $a;
}
public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested)
public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -125,7 +125,7 @@ class AmqpCaster
return $a;
}
public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)
public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -153,7 +153,7 @@ class AmqpCaster
return $a;
}
public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;

View File

@@ -40,17 +40,14 @@ class Caster
/**
* Casts objects to arrays and adds the dynamic property prefix.
*
* @param object $obj The object to cast
* @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not
*
* @return array The array-cast of the object, with prefixed dynamic properties
* @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not
*/
public static function castObject($obj, string $class, bool $hasDebugInfo = false, string $debugClass = null): array
public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, string $debugClass = null): array
{
if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Exception $e) {
} catch (\Throwable $e) {
// ignore failing __debugInfo()
$hasDebugInfo = false;
}
@@ -69,7 +66,7 @@ class Caster
$i = 0;
$prefixedKeys = [];
foreach ($a as $k => $v) {
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
if ("\0" !== ($k[0] ?? '')) {
if (!isset($publicProperties[$class])) {
foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
$publicProperties[$class][$prop->name] = true;
@@ -119,8 +116,6 @@ class Caster
* @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out
* @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set
* @param int &$count Set to the number of removed properties
*
* @return array The filtered array
*/
public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array
{

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class DOMCaster
{
@@ -63,7 +63,7 @@ class DOMCaster
\XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
];
public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)
public static function castException(\DOMException $e, array $a, Stub $stub, bool $isNested)
{
$k = Caster::PREFIX_PROTECTED.'code';
if (isset($a[$k], self::ERROR_CODES[$a[$k]])) {
@@ -73,7 +73,7 @@ class DOMCaster
return $a;
}
public static function castLength($dom, array $a, Stub $stub, $isNested)
public static function castLength($dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'length' => $dom->length,
@@ -82,7 +82,7 @@ class DOMCaster
return $a;
}
public static function castImplementation($dom, array $a, Stub $stub, $isNested)
public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
@@ -92,7 +92,7 @@ class DOMCaster
return $a;
}
public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)
public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'nodeName' => $dom->nodeName,
@@ -116,7 +116,7 @@ class DOMCaster
return $a;
}
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'nodeName' => $dom->nodeName,
@@ -132,7 +132,7 @@ class DOMCaster
return $a;
}
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$a += [
'doctype' => $dom->doctype,
@@ -166,7 +166,7 @@ class DOMCaster
return $a;
}
public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)
public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'data' => $dom->data,
@@ -176,7 +176,7 @@ class DOMCaster
return $a;
}
public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)
public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'name' => $dom->name,
@@ -189,7 +189,7 @@ class DOMCaster
return $a;
}
public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)
public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'tagName' => $dom->tagName,
@@ -199,7 +199,7 @@ class DOMCaster
return $a;
}
public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)
public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'wholeText' => $dom->wholeText,
@@ -208,7 +208,7 @@ class DOMCaster
return $a;
}
public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)
public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'typeName' => $dom->typeName,
@@ -218,7 +218,7 @@ class DOMCaster
return $a;
}
public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)
public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'severity' => $dom->severity,
@@ -232,7 +232,7 @@ class DOMCaster
return $a;
}
public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)
public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'lineNumber' => $dom->lineNumber,
@@ -245,7 +245,7 @@ class DOMCaster
return $a;
}
public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)
public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'name' => $dom->name,
@@ -259,7 +259,7 @@ class DOMCaster
return $a;
}
public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)
public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'publicId' => $dom->publicId,
@@ -269,7 +269,7 @@ class DOMCaster
return $a;
}
public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)
public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'publicId' => $dom->publicId,
@@ -283,7 +283,7 @@ class DOMCaster
return $a;
}
public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)
public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'target' => $dom->target,
@@ -293,7 +293,7 @@ class DOMCaster
return $a;
}
public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)
public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'document' => $dom->document,

View File

@@ -18,13 +18,13 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Dany Maillard <danymaillard93b@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class DateCaster
{
private const PERIOD_LIMIT = 3;
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter)
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter)
{
$prefix = Caster::PREFIX_VIRTUAL;
$location = $d->getTimezone()->getLocation();
@@ -47,7 +47,7 @@ class DateCaster
return $a;
}
public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter)
public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter)
{
$now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
@@ -76,7 +76,7 @@ class DateCaster
return $i->format(rtrim($format));
}
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter)
{
$location = $timeZone->getLocation();
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
@@ -87,21 +87,19 @@ class DateCaster
return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
}
public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)
public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $isNested, int $filter)
{
$dates = [];
if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/74639
foreach (clone $p as $i => $d) {
if (self::PERIOD_LIMIT === $i) {
$now = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u')))
: $p->recurrences - $i
);
break;
}
$dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d));
foreach (clone $p as $i => $d) {
if (self::PERIOD_LIMIT === $i) {
$now = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u')))
: $p->recurrences - $i
);
break;
}
$dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d));
}
$period = sprintf(

View File

@@ -21,11 +21,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested)
{
foreach (['__cloner__', '__initializer__'] as $k) {
if (\array_key_exists($k, $a)) {
@@ -37,7 +37,7 @@ class DoctrineCaster
return $a;
}
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested)
{
foreach (['_entityPersister', '_identifier'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
@@ -49,7 +49,7 @@ class DoctrineCaster
return $a;
}
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested)
{
foreach (['snapshot', 'association', 'typeClass'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {

View File

@@ -21,7 +21,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Jáchym Toušek <enumag@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class DsCaster
{

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class ExceptionCaster
{
@@ -46,17 +46,17 @@ class ExceptionCaster
private static $framesCache = [];
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
}
public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
}
public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)
public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested)
{
if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
@@ -65,7 +65,7 @@ class ExceptionCaster
return $a;
}
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested)
{
$trace = Caster::PREFIX_VIRTUAL.'trace';
$prefix = Caster::PREFIX_PROTECTED;
@@ -83,7 +83,7 @@ class ExceptionCaster
return $a;
}
public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)
public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested)
{
$sPrefix = "\0".SilencedErrorContext::class."\0";
@@ -110,7 +110,7 @@ class ExceptionCaster
return $a;
}
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $isNested)
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested)
{
if (!$isNested) {
return $a;
@@ -184,7 +184,7 @@ class ExceptionCaster
return $a;
}
public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $isNested)
public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested)
{
if (!$isNested) {
return $a;
@@ -212,7 +212,7 @@ class ExceptionCaster
$ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0;
$ellipsis = $ellipsis->attr['ellipsis'] ?? 0;
if (file_exists($f['file']) && 0 <= self::$srcContext) {
if (is_file($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
$template = null;
if (isset($f['object'])) {
@@ -225,7 +225,7 @@ class ExceptionCaster
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
$templateInfo = $template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
if (!method_exists($template, 'getSourceContext') || !is_file($templatePath = $template->getSourceContext()->getPath())) {
$templatePath = null;
}
if ($templateSrc) {

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts Fiber related classes to array representation.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
final class FiberCaster
{
public static function castFiber(\Fiber $fiber, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;
if ($fiber->isTerminated()) {
$status = 'terminated';
} elseif ($fiber->isRunning()) {
$status = 'running';
} elseif ($fiber->isSuspended()) {
$status = 'suspended';
} elseif ($fiber->isStarted()) {
$status = 'started';
} else {
$status = 'not started';
}
$a[$prefix.'status'] = $status;
return $a;
}
}

View File

@@ -19,11 +19,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* @author Hamza Amrouche <hamza.simperfit@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class GmpCaster
{
public static function castGmp(\GMP $gmp, array $a, Stub $stub, $isNested, $filter): array
public static function castGmp(\GMP $gmp, array $a, Stub $stub, bool $isNested, int $filter): array
{
$a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));

View File

@@ -16,7 +16,7 @@ namespace Symfony\Component\VarDumper\Caster;
*/
class ImgStub extends ConstStub
{
public function __construct(string $data, string $contentType, string $size)
public function __construct(string $data, string $contentType, string $size = '')
{
$this->value = '';
$this->attr['img-data'] = $data;

View File

@@ -17,11 +17,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* @author Nicolas Grekas <p@tchwork.com>
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
*
* @final since Symfony 4.4
* @final
*/
class IntlCaster
{
public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, $isNested)
public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
@@ -31,7 +31,7 @@ class IntlCaster
return self::castError($c, $a);
}
public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
@@ -108,7 +108,7 @@ class IntlCaster
return self::castError($c, $a);
}
public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, $isNested)
public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'display_name' => $c->getDisplayName(),
@@ -125,7 +125,7 @@ class IntlCaster
return self::castError($c, $a);
}
public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$a += [
Caster::PREFIX_VIRTUAL.'type' => $c->getType(),
@@ -142,7 +142,7 @@ class IntlCaster
return self::castError($c, $a);
}
public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
@@ -158,7 +158,7 @@ class IntlCaster
return self::castError($c, $a);
}
private static function castError($c, array $a): array
private static function castError(object $c, array $a): array
{
if ($errorCode = $c->getErrorCode()) {
$a += [

View File

@@ -43,7 +43,7 @@ class LinkStub extends ConstStub
return;
}
if (!file_exists($href)) {
if (!is_file($href)) {
return;
}
if ($line) {
@@ -72,7 +72,7 @@ class LinkStub extends ConstStub
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname($r->getFileName(), 2);
if (file_exists($v.'/composer/installed.json')) {
if (is_file($v.'/composer/installed.json')) {
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
}
}
@@ -91,7 +91,7 @@ class LinkStub extends ConstStub
}
$parent = $dir;
while (!@file_exists($parent.'/composer.json')) {
while (!@is_file($parent.'/composer.json')) {
if (!@file_exists($parent)) {
// open_basedir restriction in effect
break;

View File

@@ -16,14 +16,14 @@ use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
*
* @final since Symfony 4.4
* @final
*/
class MemcachedCaster
{
private static $optionConstants;
private static $defaultOptions;
public static function castMemcached(\Memcached $c, array $a, Stub $stub, $isNested)
public static function castMemcached(\Memcached $c, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(),

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class PdoCaster
{
@@ -59,7 +59,7 @@ class PdoCaster
],
];
public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)
public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
{
$attr = [];
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
@@ -108,7 +108,7 @@ class PdoCaster
return $a;
}
public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)
public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a[$prefix.'errorInfo'] = $c->errorInfo();

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class PgSqlCaster
{
@@ -69,14 +69,14 @@ class PgSqlCaster
'function' => \PGSQL_DIAG_SOURCE_FUNCTION,
];
public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested)
{
$a['seek position'] = pg_lo_tell($lo);
return $a;
}
public static function castLink($link, array $a, Stub $stub, $isNested)
public static function castLink($link, array $a, Stub $stub, bool $isNested)
{
$a['status'] = pg_connection_status($link);
$a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
@@ -108,7 +108,7 @@ class PgSqlCaster
return $a;
}
public static function castResult($result, array $a, Stub $stub, $isNested)
public static function castResult($result, array $a, Stub $stub, bool $isNested)
{
$a['num rows'] = pg_num_rows($result);
$a['status'] = pg_result_status($result);

View File

@@ -17,11 +17,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class ProxyManagerCaster
{
public static function castProxy(ProxyInterface $c, array $a, Stub $stub, $isNested)
public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested)
{
if ($parent = get_parent_class($c)) {
$stub->class .= ' - '.$parent;

View File

@@ -0,0 +1,186 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 RdKafka\Conf;
use RdKafka\Exception as RdKafkaException;
use RdKafka\KafkaConsumer;
use RdKafka\Message;
use RdKafka\Metadata\Broker as BrokerMetadata;
use RdKafka\Metadata\Collection as CollectionMetadata;
use RdKafka\Metadata\Partition as PartitionMetadata;
use RdKafka\Metadata\Topic as TopicMetadata;
use RdKafka\Topic;
use RdKafka\TopicConf;
use RdKafka\TopicPartition;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts RdKafka related classes to array representation.
*
* @author Romain Neutron <imprec@gmail.com>
*/
class RdKafkaCaster
{
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
try {
$assignment = $c->getAssignment();
} catch (RdKafkaException $e) {
$assignment = [];
}
$a += [
$prefix.'subscription' => $c->getSubscription(),
$prefix.'assignment' => $assignment,
];
$a += self::extractMetadata($c);
return $a;
}
public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'name' => $c->getName(),
];
return $a;
}
public static function castTopicPartition(TopicPartition $c, array $a)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'offset' => $c->getOffset(),
$prefix.'partition' => $c->getPartition(),
$prefix.'topic' => $c->getTopic(),
];
return $a;
}
public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'errstr' => $c->errstr(),
];
return $a;
}
public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
foreach ($c->dump() as $key => $value) {
$a[$prefix.$key] = $value;
}
return $a;
}
public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
foreach ($c->dump() as $key => $value) {
$a[$prefix.$key] = $value;
}
return $a;
}
public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'out_q_len' => $c->getOutQLen(),
];
$a += self::extractMetadata($c);
return $a;
}
public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested)
{
$a += iterator_to_array($c);
return $a;
}
public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'name' => $c->getTopic(),
$prefix.'partitions' => $c->getPartitions(),
];
return $a;
}
public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'id' => $c->getId(),
$prefix.'err' => $c->getErr(),
$prefix.'leader' => $c->getLeader(),
];
return $a;
}
public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'id' => $c->getId(),
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
];
return $a;
}
private static function extractMetadata($c)
{
$prefix = Caster::PREFIX_VIRTUAL;
try {
$m = $c->getMetadata(true, null, 500);
} catch (RdKafkaException $e) {
return [];
}
return [
$prefix.'orig_broker_id' => $m->getOrigBrokerId(),
$prefix.'orig_broker_name' => $m->getOrigBrokerName(),
$prefix.'brokers' => $m->getBrokers(),
$prefix.'topics' => $m->getTopics(),
];
}
}

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class RedisCaster
{
@@ -46,7 +46,7 @@ class RedisCaster
\RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
];
public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -72,7 +72,7 @@ class RedisCaster
];
}
public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -84,7 +84,7 @@ class RedisCaster
];
}
public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, $isNested)
public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class ReflectionCaster
{
@@ -35,7 +35,7 @@ class ReflectionCaster
'isVariadic' => 'isVariadic',
];
public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;
$c = new \ReflectionFunction($c);
@@ -78,7 +78,7 @@ class ReflectionCaster
return $a;
}
public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested)
{
// Cannot create ReflectionGenerator based on a terminated Generator
try {
@@ -92,7 +92,7 @@ class ReflectionCaster
return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
}
public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)
public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -114,7 +114,17 @@ class ReflectionCaster
return $a;
}
public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, $isNested)
public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested)
{
self::addMap($a, $c, [
'name' => 'getName',
'arguments' => 'getArguments',
]);
return $a;
}
public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -149,7 +159,7 @@ class ReflectionCaster
return $a;
}
public static function castClass(\ReflectionClass $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -160,7 +170,7 @@ class ReflectionCaster
self::addMap($a, $c, [
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getConstants',
'constants' => 'getReflectionConstants',
]);
foreach ($c->getProperties() as $n) {
@@ -171,6 +181,8 @@ class ReflectionCaster
$a[$prefix.'methods'][$n->name] = $n;
}
self::addAttributes($a, $c, $prefix);
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}
@@ -178,14 +190,14 @@ class ReflectionCaster
return $a;
}
public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, $isNested, $filter = 0)
public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;
self::addMap($a, $c, [
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureScopeClass',
'class' => \PHP_VERSION_ID >= 80111 ? 'getClosureCalledClass' : 'getClosureScopeClass',
'this' => 'getClosureThis',
]);
@@ -215,6 +227,8 @@ class ReflectionCaster
$a[$prefix.'parameters'] = new EnumStub($a[$prefix.'parameters']);
}
self::addAttributes($a, $c, $prefix);
if (!($filter & Caster::EXCLUDE_VERBOSE) && $v = $c->getStaticVariables()) {
foreach ($v as $k => &$v) {
if (\is_object($v)) {
@@ -234,14 +248,24 @@ class ReflectionCaster
return $a;
}
public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, $isNested)
public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
$a[Caster::PREFIX_VIRTUAL.'value'] = $c->getValue();
self::addAttributes($a, $c);
return $a;
}
public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
return $a;
}
public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, $isNested)
public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
@@ -252,6 +276,8 @@ class ReflectionCaster
'allowsNull' => 'allowsNull',
]);
self::addAttributes($a, $c, $prefix);
if ($v = $c->getType()) {
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
}
@@ -279,22 +305,24 @@ class ReflectionCaster
return $a;
}
public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, $isNested)
public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
self::addAttributes($a, $c);
self::addExtra($a, $c);
return $a;
}
public static function castReference(\ReflectionReference $c, array $a, Stub $stub, $isNested)
public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
return $a;
}
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested)
{
self::addMap($a, $c, [
'version' => 'getVersion',
@@ -310,7 +338,7 @@ class ReflectionCaster
return $a;
}
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested)
{
self::addMap($a, $c, [
'version' => 'getVersion',
@@ -390,7 +418,7 @@ class ReflectionCaster
}
}
private static function addMap(array &$a, $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL)
private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL)
{
foreach ($map as $k => $m) {
if (\PHP_VERSION_ID >= 80000 && 'isDisabled' === $k) {
@@ -402,4 +430,13 @@ class ReflectionCaster
}
}
}
private static function addAttributes(array &$a, \Reflector $c, string $prefix = Caster::PREFIX_VIRTUAL): void
{
if (\PHP_VERSION_ID >= 80000) {
foreach ($c->getAttributes() as $n) {
$a[$prefix.'attributes'][] = $n;
}
}
}
}

View File

@@ -18,21 +18,19 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class ResourceCaster
{
/**
* @param \CurlHandle|resource $h
*
* @return array
*/
public static function castCurl($h, array $a, Stub $stub, $isNested)
public static function castCurl($h, array $a, Stub $stub, bool $isNested): array
{
return curl_getinfo($h);
}
public static function castDba($dba, array $a, Stub $stub, $isNested)
public static function castDba($dba, array $a, Stub $stub, bool $isNested)
{
$list = dba_list();
$a['file'] = $list[(int) $dba];
@@ -40,12 +38,12 @@ class ResourceCaster
return $a;
}
public static function castProcess($process, array $a, Stub $stub, $isNested)
public static function castProcess($process, array $a, Stub $stub, bool $isNested)
{
return proc_get_status($process);
}
public static function castStream($stream, array $a, Stub $stub, $isNested)
public static function castStream($stream, array $a, Stub $stub, bool $isNested)
{
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
if ($a['uri'] ?? false) {
@@ -55,12 +53,12 @@ class ResourceCaster
return $a;
}
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested)
{
return @stream_context_get_params($stream) ?: $a;
}
public static function castGd($gd, array $a, Stub $stub, $isNested)
public static function castGd($gd, array $a, Stub $stub, bool $isNested)
{
$a['size'] = imagesx($gd).'x'.imagesy($gd);
$a['trueColor'] = imageistruecolor($gd);
@@ -68,7 +66,7 @@ class ResourceCaster
return $a;
}
public static function castMysqlLink($h, array $a, Stub $stub, $isNested)
public static function castMysqlLink($h, array $a, Stub $stub, bool $isNested)
{
$a['host'] = mysql_get_host_info($h);
$a['protocol'] = mysql_get_proto_info($h);
@@ -77,7 +75,7 @@ class ResourceCaster
return $a;
}
public static function castOpensslX509($h, array $a, Stub $stub, $isNested)
public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested)
{
$stub->cut = -1;
$info = openssl_x509_parse($h, false);

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class SplCaster
{
@@ -29,17 +29,17 @@ class SplCaster
\SplFileObject::READ_CSV => 'READ_CSV',
];
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested)
{
return self::castSplArray($c, $a, $stub, $isNested);
}
public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, $isNested)
public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested)
{
return self::castSplArray($c, $a, $stub, $isNested);
}
public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
@@ -48,7 +48,7 @@ class SplCaster
return $a;
}
public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$mode = $c->getIteratorMode();
@@ -63,7 +63,7 @@ class SplCaster
return $a;
}
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested)
{
static $map = [
'path' => 'getPath',
@@ -147,7 +147,7 @@ class SplCaster
return $a;
}
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested)
{
static $map = [
'csvControl' => 'getCsvControl',
@@ -184,7 +184,7 @@ class SplCaster
return $a;
}
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested)
{
$storage = [];
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
@@ -205,14 +205,14 @@ class SplCaster
return $a;
}
public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, $isNested)
public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
return $a;
}
public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, $isNested)
public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();

View File

@@ -18,11 +18,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class StubCaster
{
public static function castStub(Stub $c, array $a, Stub $stub, $isNested)
public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested)
{
if ($isNested) {
$stub->type = $c->type;
@@ -43,12 +43,12 @@ class StubCaster
return $a;
}
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested)
{
return $isNested ? $c->preservedSubset : $a;
}
public static function cutInternals($obj, array $a, Stub $stub, $isNested)
public static function cutInternals($obj, array $a, Stub $stub, bool $isNested)
{
if ($isNested) {
$stub->cut += \count($a);
@@ -59,7 +59,7 @@ class StubCaster
return $a;
}
public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested)
{
if ($isNested) {
$stub->class = $c->dumpKeys ? '' : null;

View File

@@ -12,10 +12,12 @@
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Uid\Ulid;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @final since Symfony 4.4
* @final
*/
class SymfonyCaster
{
@@ -28,7 +30,7 @@ class SymfonyCaster
'format' => 'getRequestFormat',
];
public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested)
{
$clone = null;
@@ -45,7 +47,7 @@ class SymfonyCaster
return $a;
}
public static function castHttpClient($client, array $a, Stub $stub, $isNested)
public static function castHttpClient($client, array $a, Stub $stub, bool $isNested)
{
$multiKey = sprintf("\0%s\0multi", \get_class($client));
if (isset($a[$multiKey])) {
@@ -55,7 +57,7 @@ class SymfonyCaster
return $a;
}
public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)
public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested)
{
$stub->cut += \count($a);
$a = [];
@@ -66,4 +68,30 @@ class SymfonyCaster
return $a;
}
public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'toBase58'] = $uuid->toBase58();
$a[Caster::PREFIX_VIRTUAL.'toBase32'] = $uuid->toBase32();
// symfony/uid >= 5.3
if (method_exists($uuid, 'getDateTime')) {
$a[Caster::PREFIX_VIRTUAL.'time'] = $uuid->getDateTime()->format('Y-m-d H:i:s.u \U\T\C');
}
return $a;
}
public static function castUlid(Ulid $ulid, array $a, Stub $stub, bool $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'toBase58'] = $ulid->toBase58();
$a[Caster::PREFIX_VIRTUAL.'toRfc4122'] = $ulid->toRfc4122();
// symfony/uid >= 5.3
if (method_exists($ulid, 'getDateTime')) {
$a[Caster::PREFIX_VIRTUAL.'time'] = $ulid->getDateTime()->format('Y-m-d H:i:s.v \U\T\C');
}
return $a;
}
}

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Baptiste Clavié <clavie.b@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class XmlReaderCaster
{
@@ -43,7 +43,7 @@ class XmlReaderCaster
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
];
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested)
{
try {
$properties = [

View File

@@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class XmlResourceCaster
{
@@ -47,7 +47,7 @@ class XmlResourceCaster
\XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
];
public static function castXml($h, array $a, Stub $stub, $isNested)
public static function castXml($h, array $a, Stub $stub, bool $isNested)
{
$a['current_byte_index'] = xml_get_current_byte_index($h);
$a['current_column_number'] = xml_get_current_column_number($h);