upgraded dependencies
This commit is contained in:
19
vendor/symfony/var-dumper/CHANGELOG.md
vendored
19
vendor/symfony/var-dumper/CHANGELOG.md
vendored
@@ -1,6 +1,25 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
5.4
|
||||
---
|
||||
|
||||
* Add ability to style integer and double values independently
|
||||
* Add casters for Symfony's UUIDs and ULIDs
|
||||
* Add support for `Fiber`
|
||||
|
||||
5.2.0
|
||||
-----
|
||||
|
||||
* added support for PHPUnit `--colors` option
|
||||
* added `VAR_DUMPER_FORMAT=server` env var value support
|
||||
* prevent replacing the handler when the `VAR_DUMPER_FORMAT` env var is set
|
||||
|
||||
5.1.0
|
||||
-----
|
||||
|
||||
* added `RdKafka` support
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
||||
|
12
vendor/symfony/var-dumper/Caster/AmqpCaster.php
vendored
12
vendor/symfony/var-dumper/Caster/AmqpCaster.php
vendored
@@ -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;
|
||||
|
||||
|
13
vendor/symfony/var-dumper/Caster/Caster.php
vendored
13
vendor/symfony/var-dumper/Caster/Caster.php
vendored
@@ -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
|
||||
{
|
||||
|
38
vendor/symfony/var-dumper/Caster/DOMCaster.php
vendored
38
vendor/symfony/var-dumper/Caster/DOMCaster.php
vendored
@@ -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,
|
||||
|
30
vendor/symfony/var-dumper/Caster/DateCaster.php
vendored
30
vendor/symfony/var-dumper/Caster/DateCaster.php
vendored
@@ -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(
|
||||
|
@@ -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)) {
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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) {
|
||||
|
43
vendor/symfony/var-dumper/Caster/FiberCaster.php
vendored
Normal file
43
vendor/symfony/var-dumper/Caster/FiberCaster.php
vendored
Normal 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;
|
||||
}
|
||||
}
|
@@ -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));
|
||||
|
||||
|
2
vendor/symfony/var-dumper/Caster/ImgStub.php
vendored
2
vendor/symfony/var-dumper/Caster/ImgStub.php
vendored
@@ -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;
|
||||
|
14
vendor/symfony/var-dumper/Caster/IntlCaster.php
vendored
14
vendor/symfony/var-dumper/Caster/IntlCaster.php
vendored
@@ -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 += [
|
||||
|
@@ -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;
|
||||
|
@@ -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(),
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
186
vendor/symfony/var-dumper/Caster/RdKafkaCaster.php
vendored
Normal file
186
vendor/symfony/var-dumper/Caster/RdKafkaCaster.php
vendored
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
20
vendor/symfony/var-dumper/Caster/SplCaster.php
vendored
20
vendor/symfony/var-dumper/Caster/SplCaster.php
vendored
@@ -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();
|
||||
|
||||
|
10
vendor/symfony/var-dumper/Caster/StubCaster.php
vendored
10
vendor/symfony/var-dumper/Caster/StubCaster.php
vendored
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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 = [
|
||||
|
@@ -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);
|
||||
|
@@ -29,11 +29,15 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
|
||||
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
|
||||
|
||||
'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'],
|
||||
|
||||
'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'],
|
||||
'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'],
|
||||
'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'],
|
||||
'ReflectionAttribute' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castAttribute'],
|
||||
'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'],
|
||||
'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'],
|
||||
'ReflectionClassConstant' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClassConstant'],
|
||||
'ReflectionFunctionAbstract' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'],
|
||||
'ReflectionMethod' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'],
|
||||
'ReflectionParameter' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'],
|
||||
@@ -76,13 +80,18 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'],
|
||||
'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'],
|
||||
'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'],
|
||||
'Symfony\Bridge\Monolog\Logger' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||
'Symfony\Component\HttpClient\AmpHttpClient' => ['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\Response\AmpResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
|
||||
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
|
||||
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
|
||||
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
|
||||
'Symfony\Component\Uid\Ulid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'],
|
||||
'Symfony\Component\Uid\Uuid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'],
|
||||
'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\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
|
||||
@@ -171,14 +180,34 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
|
||||
'XmlParser' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'],
|
||||
':xml' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'],
|
||||
|
||||
'RdKafka' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castRdKafka'],
|
||||
'RdKafka\Conf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castConf'],
|
||||
'RdKafka\KafkaConsumer' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castKafkaConsumer'],
|
||||
'RdKafka\Metadata\Broker' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castBrokerMetadata'],
|
||||
'RdKafka\Metadata\Collection' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castCollectionMetadata'],
|
||||
'RdKafka\Metadata\Partition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castPartitionMetadata'],
|
||||
'RdKafka\Metadata\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicMetadata'],
|
||||
'RdKafka\Message' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castMessage'],
|
||||
'RdKafka\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopic'],
|
||||
'RdKafka\TopicPartition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicPartition'],
|
||||
'RdKafka\TopicConf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicConf'],
|
||||
];
|
||||
|
||||
protected $maxItems = 2500;
|
||||
protected $maxString = -1;
|
||||
protected $minDepth = 1;
|
||||
|
||||
/**
|
||||
* @var array<string, list<callable>>
|
||||
*/
|
||||
private $casters = [];
|
||||
|
||||
/**
|
||||
* @var callable|null
|
||||
*/
|
||||
private $prevErrorHandler;
|
||||
|
||||
private $classInfo = [];
|
||||
private $filter = 0;
|
||||
|
||||
@@ -214,33 +243,27 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
|
||||
/**
|
||||
* Sets the maximum number of items to clone past the minimum depth in nested structures.
|
||||
*
|
||||
* @param int $maxItems
|
||||
*/
|
||||
public function setMaxItems($maxItems)
|
||||
public function setMaxItems(int $maxItems)
|
||||
{
|
||||
$this->maxItems = (int) $maxItems;
|
||||
$this->maxItems = $maxItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum cloned length for strings.
|
||||
*
|
||||
* @param int $maxString
|
||||
*/
|
||||
public function setMaxString($maxString)
|
||||
public function setMaxString(int $maxString)
|
||||
{
|
||||
$this->maxString = (int) $maxString;
|
||||
$this->maxString = $maxString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum tree depth where we are guaranteed to clone all the items. After this
|
||||
* depth is reached, only setMaxItems items will be cloned.
|
||||
*
|
||||
* @param int $minDepth
|
||||
*/
|
||||
public function setMinDepth($minDepth)
|
||||
public function setMinDepth(int $minDepth)
|
||||
{
|
||||
$this->minDepth = (int) $minDepth;
|
||||
$this->minDepth = $minDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,9 +272,9 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
* @param mixed $var Any PHP variable
|
||||
* @param int $filter A bit field of Caster::EXCLUDE_* constants
|
||||
*
|
||||
* @return Data The cloned variable represented by a Data object
|
||||
* @return Data
|
||||
*/
|
||||
public function cloneVar($var, $filter = 0)
|
||||
public function cloneVar($var, int $filter = 0)
|
||||
{
|
||||
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
|
||||
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
|
||||
@@ -286,7 +309,7 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
*
|
||||
* @param mixed $var Any PHP variable
|
||||
*
|
||||
* @return array The cloned variable represented in an array
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function doClone($var);
|
||||
|
||||
@@ -295,9 +318,9 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
*
|
||||
* @param bool $isNested True if the object is nested in the dumped structure
|
||||
*
|
||||
* @return array The object casted as array
|
||||
* @return array
|
||||
*/
|
||||
protected function castObject(Stub $stub, $isNested)
|
||||
protected function castObject(Stub $stub, bool $isNested)
|
||||
{
|
||||
$obj = $stub->value;
|
||||
$class = $stub->class;
|
||||
@@ -354,9 +377,9 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
*
|
||||
* @param bool $isNested True if the object is nested in the dumped structure
|
||||
*
|
||||
* @return array The resource casted as array
|
||||
* @return array
|
||||
*/
|
||||
protected function castResource(Stub $stub, $isNested)
|
||||
protected function castResource(Stub $stub, bool $isNested)
|
||||
{
|
||||
$a = [];
|
||||
$res = $stub->value;
|
||||
|
@@ -21,7 +21,7 @@ interface ClonerInterface
|
||||
*
|
||||
* @param mixed $var Any PHP variable
|
||||
*
|
||||
* @return Data The cloned variable represented by a Data object
|
||||
* @return Data
|
||||
*/
|
||||
public function cloneVar($var);
|
||||
}
|
||||
|
28
vendor/symfony/var-dumper/Cloner/Data.php
vendored
28
vendor/symfony/var-dumper/Cloner/Data.php
vendored
@@ -36,7 +36,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null The type of the value
|
||||
* @return string|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
@@ -65,9 +65,11 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a native representation of the original value.
|
||||
*
|
||||
* @param array|bool $recursive Whether values should be resolved recursively or not
|
||||
*
|
||||
* @return string|int|float|bool|array|Data[]|null A native representation of the original value
|
||||
* @return string|int|float|bool|array|Data[]|null
|
||||
*/
|
||||
public function getValue($recursive = false)
|
||||
{
|
||||
@@ -124,13 +126,13 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
public function getIterator()
|
||||
{
|
||||
if (!\is_array($value = $this->getValue())) {
|
||||
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, \gettype($value)));
|
||||
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
|
||||
}
|
||||
|
||||
yield from $value;
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
public function __get(string $key)
|
||||
{
|
||||
if (null !== $data = $this->seek($key)) {
|
||||
$item = $this->getStub($data->data[$data->position][$data->key]);
|
||||
@@ -144,7 +146,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($key)
|
||||
public function __isset(string $key)
|
||||
{
|
||||
return null !== $this->seek($key);
|
||||
}
|
||||
@@ -202,14 +204,12 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
/**
|
||||
* Returns a depth limited clone of $this.
|
||||
*
|
||||
* @param int $maxDepth The max dumped depth level
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function withMaxDepth($maxDepth)
|
||||
public function withMaxDepth(int $maxDepth)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->maxDepth = (int) $maxDepth;
|
||||
$data->maxDepth = $maxDepth;
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -217,14 +217,12 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
/**
|
||||
* Limits the number of elements per depth level.
|
||||
*
|
||||
* @param int $maxItemsPerDepth The max number of items dumped per depth level
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function withMaxItemsPerDepth($maxItemsPerDepth)
|
||||
public function withMaxItemsPerDepth(int $maxItemsPerDepth)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->maxItemsPerDepth = (int) $maxItemsPerDepth;
|
||||
$data->maxItemsPerDepth = $maxItemsPerDepth;
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -236,7 +234,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function withRefHandles($useRefHandles)
|
||||
public function withRefHandles(bool $useRefHandles)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->useRefHandles = $useRefHandles ? -1 : 0;
|
||||
@@ -260,7 +258,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
*
|
||||
* @param string|int $key The key to seek to
|
||||
*
|
||||
* @return static|null Null if the key is not set
|
||||
* @return static|null
|
||||
*/
|
||||
public function seek($key)
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@ interface DumperInterface
|
||||
* @param string $type The PHP type of the value being dumped
|
||||
* @param string|int|float|bool $value The scalar value being dumped
|
||||
*/
|
||||
public function dumpScalar(Cursor $cursor, $type, $value);
|
||||
public function dumpScalar(Cursor $cursor, string $type, $value);
|
||||
|
||||
/**
|
||||
* Dumps a string.
|
||||
@@ -33,7 +33,7 @@ interface DumperInterface
|
||||
* @param bool $bin Whether $str is UTF-8 or binary encoded
|
||||
* @param int $cut The number of characters $str has been cut by
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut);
|
||||
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut);
|
||||
|
||||
/**
|
||||
* Dumps while entering an hash.
|
||||
@@ -42,7 +42,7 @@ interface DumperInterface
|
||||
* @param string|int $class The object class, resource type or array count
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
|
||||
public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild);
|
||||
|
||||
/**
|
||||
* Dumps while leaving an hash.
|
||||
@@ -52,5 +52,5 @@ interface DumperInterface
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
|
||||
public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut);
|
||||
}
|
||||
|
89
vendor/symfony/var-dumper/Cloner/VarCloner.php
vendored
89
vendor/symfony/var-dumper/Cloner/VarCloner.php
vendored
@@ -27,13 +27,12 @@ class VarCloner extends AbstractCloner
|
||||
$len = 1; // Length of $queue
|
||||
$pos = 0; // Number of cloned items past the minimum depth
|
||||
$refsCounter = 0; // Hard references counter
|
||||
$queue = [[$var]]; // This breadth-first queue is the return value
|
||||
$indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays
|
||||
$hardRefs = []; // Map of original zval ids to stub objects
|
||||
$objRefs = []; // Map of original object handles to their stub object counterpart
|
||||
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
|
||||
$resRefs = []; // Map of original resource handles to their stub object counterpart
|
||||
$values = []; // Map of stub objects' ids to original values
|
||||
$queue = [[$var]]; // This breadth-first queue is the return value
|
||||
$hardRefs = []; // Map of original zval ids to stub objects
|
||||
$objRefs = []; // Map of original object handles to their stub object counterpart
|
||||
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
|
||||
$resRefs = []; // Map of original resource handles to their stub object counterpart
|
||||
$values = []; // Map of stub objects' ids to original values
|
||||
$maxItems = $this->maxItems;
|
||||
$maxString = $this->maxString;
|
||||
$minDepth = $this->minDepth;
|
||||
@@ -63,21 +62,6 @@ class VarCloner extends AbstractCloner
|
||||
}
|
||||
|
||||
$refs = $vals = $queue[$i];
|
||||
if (\PHP_VERSION_ID < 70200 && empty($indexedArrays[$i])) {
|
||||
// see https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
|
||||
foreach ($vals as $k => $v) {
|
||||
if (\is_int($k)) {
|
||||
continue;
|
||||
}
|
||||
foreach ([$k => true] as $gk => $gv) {
|
||||
}
|
||||
if ($gk !== $k) {
|
||||
$fromObjCast = true;
|
||||
$refs = $vals = array_values($queue[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($vals as $k => $v) {
|
||||
// $v is the original value or a stub object in case of hard references
|
||||
|
||||
@@ -116,7 +100,7 @@ class VarCloner extends AbstractCloner
|
||||
$values[$h] = $v;
|
||||
}
|
||||
}
|
||||
// Create $stub when the original value $v can not be used directly
|
||||
// Create $stub when the original value $v cannot be used directly
|
||||
// If $v is a nested structure, put that structure in array $a
|
||||
switch (true) {
|
||||
case null === $v:
|
||||
@@ -155,51 +139,54 @@ class VarCloner extends AbstractCloner
|
||||
continue 2;
|
||||
}
|
||||
$stub = $arrayStub;
|
||||
|
||||
if (\PHP_VERSION_ID >= 80100) {
|
||||
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
|
||||
$a = $v;
|
||||
break;
|
||||
}
|
||||
|
||||
$stub->class = Stub::ARRAY_INDEXED;
|
||||
|
||||
$j = -1;
|
||||
foreach ($v as $gk => $gv) {
|
||||
if ($gk !== ++$j) {
|
||||
$stub->class = Stub::ARRAY_ASSOC;
|
||||
$a = $v;
|
||||
$a[$gid] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$a = $v;
|
||||
|
||||
if (Stub::ARRAY_ASSOC === $stub->class) {
|
||||
// Copies of $GLOBALS have very strange behavior,
|
||||
// let's detect them with some black magic
|
||||
if (\PHP_VERSION_ID < 80100 && ($a[$gid] = true) && isset($v[$gid])) {
|
||||
unset($v[$gid]);
|
||||
$a = [];
|
||||
foreach ($v as $gk => &$gv) {
|
||||
if ($v === $gv && (\PHP_VERSION_ID < 70400 || !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()]))) {
|
||||
unset($v);
|
||||
$v = new Stub();
|
||||
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
|
||||
$v->handle = -1;
|
||||
if (\PHP_VERSION_ID >= 70400) {
|
||||
$gv = &$a[$gk];
|
||||
$hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv;
|
||||
} else {
|
||||
$gv = &$hardRefs[spl_object_id($v)];
|
||||
}
|
||||
$gv = $v;
|
||||
// Copies of $GLOBALS have very strange behavior,
|
||||
// let's detect them with some black magic
|
||||
if (isset($v[$gid])) {
|
||||
unset($v[$gid]);
|
||||
$a = [];
|
||||
foreach ($v as $gk => &$gv) {
|
||||
if ($v === $gv && (\PHP_VERSION_ID < 70400 || !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()]))) {
|
||||
unset($v);
|
||||
$v = new Stub();
|
||||
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
|
||||
$v->handle = -1;
|
||||
if (\PHP_VERSION_ID >= 70400) {
|
||||
$gv = &$a[$gk];
|
||||
$hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv;
|
||||
} else {
|
||||
$gv = &$hardRefs[spl_object_id($v)];
|
||||
}
|
||||
|
||||
$a[$gk] = &$gv;
|
||||
$gv = $v;
|
||||
}
|
||||
unset($gv);
|
||||
} else {
|
||||
$a = $v;
|
||||
|
||||
$a[$gk] = &$gv;
|
||||
}
|
||||
} elseif (\PHP_VERSION_ID < 70200) {
|
||||
$indexedArrays[$len] = true;
|
||||
unset($gv);
|
||||
} else {
|
||||
$a = $v;
|
||||
}
|
||||
break;
|
||||
|
||||
case \is_object($v):
|
||||
case $v instanceof \__PHP_Incomplete_Class:
|
||||
if (empty($objRefs[$h = spl_object_id($v)])) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_OBJECT;
|
||||
|
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\VarDumper\Command\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
@@ -29,12 +28,10 @@ class CliDescriptor implements DumpDescriptorInterface
|
||||
{
|
||||
private $dumper;
|
||||
private $lastIdentifier;
|
||||
private $supportsHref;
|
||||
|
||||
public function __construct(CliDumper $dumper)
|
||||
{
|
||||
$this->dumper = $dumper;
|
||||
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
|
||||
}
|
||||
|
||||
public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void
|
||||
@@ -66,8 +63,7 @@ class CliDescriptor implements DumpDescriptorInterface
|
||||
if (isset($context['source'])) {
|
||||
$source = $context['source'];
|
||||
$sourceInfo = sprintf('%s on line %d', $source['name'], $source['line']);
|
||||
$fileLink = $source['file_link'] ?? null;
|
||||
if ($this->supportsHref && $fileLink) {
|
||||
if ($fileLink = $source['file_link'] ?? null) {
|
||||
$sourceInfo = sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
|
||||
}
|
||||
$rows[] = ['source', $sourceInfo];
|
||||
@@ -77,11 +73,6 @@ class CliDescriptor implements DumpDescriptorInterface
|
||||
|
||||
$io->table([], $rows);
|
||||
|
||||
if (!$this->supportsHref && isset($fileLink)) {
|
||||
$io->writeln(['<info>Open source in your IDE/browser:</info>', $fileLink]);
|
||||
$io->newLine();
|
||||
}
|
||||
|
||||
$this->dumper->dump($data);
|
||||
$io->newLine();
|
||||
}
|
||||
|
@@ -12,6 +12,8 @@
|
||||
namespace Symfony\Component\VarDumper\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Completion\CompletionInput;
|
||||
use Symfony\Component\Console\Completion\CompletionSuggestions;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -35,6 +37,7 @@ use Symfony\Component\VarDumper\Server\DumpServer;
|
||||
class ServerDumpCommand extends Command
|
||||
{
|
||||
protected static $defaultName = 'server:dump';
|
||||
protected static $defaultDescription = 'Start a dump server that collects and displays dumps in a single place';
|
||||
|
||||
private $server;
|
||||
|
||||
@@ -54,11 +57,9 @@ class ServerDumpCommand extends Command
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$availableFormats = implode(', ', array_keys($this->descriptors));
|
||||
|
||||
$this
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', $availableFormats), 'cli')
|
||||
->setDescription('Start a dump server that collects and displays dumps in a single place')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli')
|
||||
->setDescription(self::$defaultDescription)
|
||||
->setHelp(<<<'EOF'
|
||||
<info>%command.name%</info> starts a dump server that collects and displays
|
||||
dumps in a single place for debugging you application:
|
||||
@@ -98,4 +99,16 @@ EOF
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
|
||||
{
|
||||
if ($input->mustSuggestOptionValuesFor('format')) {
|
||||
$suggestions->suggestValues($this->getAvailableFormats());
|
||||
}
|
||||
}
|
||||
|
||||
private function getAvailableFormats(): array
|
||||
{
|
||||
return array_keys($this->descriptors);
|
||||
}
|
||||
}
|
||||
|
@@ -81,11 +81,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
/**
|
||||
* Sets the default character encoding to use for non-UTF8 strings.
|
||||
*
|
||||
* @param string $charset The default character encoding to use for non-UTF8 strings
|
||||
*
|
||||
* @return string The previous charset
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
public function setCharset(string $charset)
|
||||
{
|
||||
$prev = $this->charset;
|
||||
|
||||
@@ -104,7 +102,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
*
|
||||
* @return string The previous indent pad
|
||||
*/
|
||||
public function setIndentPad($pad)
|
||||
public function setIndentPad(string $pad)
|
||||
{
|
||||
$prev = $this->indentPad;
|
||||
$this->indentPad = $pad;
|
||||
@@ -161,7 +159,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
|
||||
* or -1 to signal the end-of-dump to the line dumper callable
|
||||
*/
|
||||
protected function dumpLine($depth)
|
||||
protected function dumpLine(int $depth)
|
||||
{
|
||||
($this->lineDumper)($this->line, $depth, $this->indentPad);
|
||||
$this->line = '';
|
||||
@@ -169,12 +167,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
|
||||
/**
|
||||
* Generic line dumper callback.
|
||||
*
|
||||
* @param string $line The line to write
|
||||
* @param int $depth The recursive depth in the dumped structure
|
||||
* @param string $indentPad The line indent pad
|
||||
*/
|
||||
protected function echoLine($line, $depth, $indentPad)
|
||||
protected function echoLine(string $line, int $depth, string $indentPad)
|
||||
{
|
||||
if (-1 !== $depth) {
|
||||
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
|
||||
@@ -184,11 +178,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
/**
|
||||
* Converts a non-UTF-8 string to UTF-8.
|
||||
*
|
||||
* @param string|null $s The non-UTF-8 string to convert
|
||||
*
|
||||
* @return string|null The string converted to UTF-8
|
||||
* @return string|null
|
||||
*/
|
||||
protected function utf8Encode($s)
|
||||
protected function utf8Encode(?string $s)
|
||||
{
|
||||
if (null === $s || preg_match('//u', $s)) {
|
||||
return $s;
|
||||
|
57
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
57
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
@@ -88,22 +88,18 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
/**
|
||||
* Enables/disables colored output.
|
||||
*
|
||||
* @param bool $colors
|
||||
*/
|
||||
public function setColors($colors)
|
||||
public function setColors(bool $colors)
|
||||
{
|
||||
$this->colors = (bool) $colors;
|
||||
$this->colors = $colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters per line for dumped strings.
|
||||
*
|
||||
* @param int $maxStringWidth
|
||||
*/
|
||||
public function setMaxStringWidth($maxStringWidth)
|
||||
public function setMaxStringWidth(int $maxStringWidth)
|
||||
{
|
||||
$this->maxStringWidth = (int) $maxStringWidth;
|
||||
$this->maxStringWidth = $maxStringWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +125,7 @@ class CliDumper extends AbstractDumper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpScalar(Cursor $cursor, $type, $value)
|
||||
public function dumpScalar(Cursor $cursor, string $type, $value)
|
||||
{
|
||||
$this->dumpKey($cursor);
|
||||
|
||||
@@ -143,11 +139,20 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
case 'integer':
|
||||
$style = 'num';
|
||||
|
||||
if (isset($this->styles['integer'])) {
|
||||
$style = 'integer';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'double':
|
||||
$style = 'num';
|
||||
|
||||
if (isset($this->styles['float'])) {
|
||||
$style = 'float';
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case \INF === $value: $value = 'INF'; break;
|
||||
case -\INF === $value: $value = '-INF'; break;
|
||||
@@ -183,7 +188,7 @@ class CliDumper extends AbstractDumper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut)
|
||||
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
|
||||
{
|
||||
$this->dumpKey($cursor);
|
||||
$attr = $cursor->attr;
|
||||
@@ -199,7 +204,7 @@ class CliDumper extends AbstractDumper
|
||||
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
|
||||
'binary' => $bin,
|
||||
];
|
||||
$str = explode("\n", $str);
|
||||
$str = $bin && false !== strpos($str, "\0") ? [$str] : explode("\n", $str);
|
||||
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
|
||||
unset($str[1]);
|
||||
$str[0] .= "\n";
|
||||
@@ -271,7 +276,7 @@ class CliDumper extends AbstractDumper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild)
|
||||
{
|
||||
if (null === $this->colors) {
|
||||
$this->colors = $this->supportsColors();
|
||||
@@ -312,7 +317,7 @@ class CliDumper extends AbstractDumper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
|
||||
public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut)
|
||||
{
|
||||
if (empty($cursor->attr['cut_hash'])) {
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
@@ -328,7 +333,7 @@ class CliDumper extends AbstractDumper
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
*/
|
||||
protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
|
||||
protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut)
|
||||
{
|
||||
if ($cut) {
|
||||
$this->line .= ' …';
|
||||
@@ -430,9 +435,9 @@ class CliDumper extends AbstractDumper
|
||||
* @param string $value The value being styled
|
||||
* @param array $attr Optional context information
|
||||
*
|
||||
* @return string The value with style decoration
|
||||
* @return string
|
||||
*/
|
||||
protected function style($style, $value, $attr = [])
|
||||
protected function style(string $style, string $value, array $attr = [])
|
||||
{
|
||||
if (null === $this->colors) {
|
||||
$this->colors = $this->supportsColors();
|
||||
@@ -506,7 +511,7 @@ class CliDumper extends AbstractDumper
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Tells if the current output stream supports ANSI colors or not
|
||||
* @return bool
|
||||
*/
|
||||
protected function supportsColors()
|
||||
{
|
||||
@@ -527,12 +532,14 @@ class CliDumper extends AbstractDumper
|
||||
case '--color=yes':
|
||||
case '--color=force':
|
||||
case '--color=always':
|
||||
case '--colors=always':
|
||||
return static::$defaultColors = true;
|
||||
|
||||
case '--no-ansi':
|
||||
case '--color=no':
|
||||
case '--color=none':
|
||||
case '--color=never':
|
||||
case '--colors=never':
|
||||
return static::$defaultColors = false;
|
||||
}
|
||||
}
|
||||
@@ -548,7 +555,7 @@ class CliDumper extends AbstractDumper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpLine($depth, $endOfValue = false)
|
||||
protected function dumpLine(int $depth, bool $endOfValue = false)
|
||||
{
|
||||
if ($this->colors) {
|
||||
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
|
||||
@@ -604,17 +611,7 @@ class CliDumper extends AbstractDumper
|
||||
|| 'xterm' === getenv('TERM');
|
||||
}
|
||||
|
||||
if (\function_exists('stream_isatty')) {
|
||||
return @stream_isatty($stream);
|
||||
}
|
||||
|
||||
if (\function_exists('posix_isatty')) {
|
||||
return @posix_isatty($stream);
|
||||
}
|
||||
|
||||
$stat = @fstat($stream);
|
||||
// Check if formatted mode is S_IFCHR
|
||||
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
||||
return stream_isatty($stream);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,7 +628,7 @@ class CliDumper extends AbstractDumper
|
||||
|| 'xterm' === getenv('TERM')
|
||||
|| 'Hyper' === getenv('TERM_PROGRAM');
|
||||
|
||||
if (!$result && \PHP_VERSION_ID >= 70200) {
|
||||
if (!$result) {
|
||||
$version = sprintf(
|
||||
'%s.%s.%s',
|
||||
PHP_WINDOWS_VERSION_MAJOR,
|
||||
|
@@ -18,8 +18,5 @@ namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
|
||||
*/
|
||||
interface ContextProviderInterface
|
||||
{
|
||||
/**
|
||||
* @return array|null Context data or null if unable to provide any context
|
||||
*/
|
||||
public function getContext(): ?array;
|
||||
}
|
||||
|
50
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
50
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
@@ -116,21 +116,16 @@ class HtmlDumper extends CliDumper
|
||||
|
||||
/**
|
||||
* Sets an HTML header that will be dumped once in the output stream.
|
||||
*
|
||||
* @param string $header An HTML string
|
||||
*/
|
||||
public function setDumpHeader($header)
|
||||
public function setDumpHeader(?string $header)
|
||||
{
|
||||
$this->dumpHeader = $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an HTML prefix and suffix that will encapse every single dump.
|
||||
*
|
||||
* @param string $prefix The prepended HTML string
|
||||
* @param string $suffix The appended HTML string
|
||||
*/
|
||||
public function setDumpBoundaries($prefix, $suffix)
|
||||
public function setDumpBoundaries(string $prefix, string $suffix)
|
||||
{
|
||||
$this->dumpPrefix = $prefix;
|
||||
$this->dumpSuffix = $suffix;
|
||||
@@ -171,6 +166,9 @@ var refStyle = doc.createElement('style'),
|
||||
e.addEventListener(n, cb, false);
|
||||
};
|
||||
|
||||
refStyle.innerHTML = 'pre.sf-dump .sf-dump-compact, .sf-dump-str-collapse .sf-dump-str-collapse, .sf-dump-str-expand .sf-dump-str-expand { display: none; }';
|
||||
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
|
||||
refStyle = doc.createElement('style');
|
||||
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
|
||||
|
||||
if (!doc.addEventListener) {
|
||||
@@ -424,19 +422,13 @@ return function (root, x) {
|
||||
a.innerHTML += ' ';
|
||||
}
|
||||
a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children';
|
||||
a.innerHTML += '<span>▼</span>';
|
||||
a.innerHTML += elt.className == 'sf-dump-compact' ? '<span>▶</span>' : '<span>▼</span>';
|
||||
a.className += ' sf-dump-toggle';
|
||||
|
||||
x = 1;
|
||||
if ('sf-dump' != elt.parentNode.className) {
|
||||
x += elt.parentNode.getAttribute('data-depth')/1;
|
||||
}
|
||||
elt.setAttribute('data-depth', x);
|
||||
var className = elt.className;
|
||||
elt.className = 'sf-dump-expanded';
|
||||
if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) {
|
||||
toggle(a);
|
||||
}
|
||||
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
|
||||
a = a.slice(1);
|
||||
elt.className += ' '+a;
|
||||
@@ -671,9 +663,6 @@ pre.sf-dump:after {
|
||||
pre.sf-dump span {
|
||||
display: inline;
|
||||
}
|
||||
pre.sf-dump .sf-dump-compact {
|
||||
display: none;
|
||||
}
|
||||
pre.sf-dump a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
@@ -705,12 +694,6 @@ pre.sf-dump code {
|
||||
padding:0;
|
||||
background:none;
|
||||
}
|
||||
.sf-dump-str-collapse .sf-dump-str-collapse {
|
||||
display: none;
|
||||
}
|
||||
.sf-dump-str-expand .sf-dump-str-expand {
|
||||
display: none;
|
||||
}
|
||||
.sf-dump-public.sf-dump-highlight,
|
||||
.sf-dump-protected.sf-dump-highlight,
|
||||
.sf-dump-private.sf-dump-highlight,
|
||||
@@ -802,11 +785,12 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut)
|
||||
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
|
||||
{
|
||||
if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) {
|
||||
$this->dumpKey($cursor);
|
||||
$this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []).' <samp>';
|
||||
$this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []);
|
||||
$this->line .= $cursor->depth >= $this->displayOptions['maxDepth'] ? ' <samp class=sf-dump-compact>' : ' <samp class=sf-dump-expanded>';
|
||||
$this->endValue($cursor);
|
||||
$this->line .= $this->indentPad;
|
||||
$this->line .= sprintf('<img src="data:%s;base64,%s" /></samp>', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data']));
|
||||
@@ -819,25 +803,23 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild)
|
||||
{
|
||||
if (Cursor::HASH_OBJECT === $type) {
|
||||
$cursor->attr['depth'] = $cursor->depth;
|
||||
}
|
||||
parent::enterHash($cursor, $type, $class, false);
|
||||
|
||||
if ($cursor->skipChildren) {
|
||||
if ($cursor->skipChildren || $cursor->depth >= $this->displayOptions['maxDepth']) {
|
||||
$cursor->skipChildren = false;
|
||||
$eol = ' class=sf-dump-compact>';
|
||||
} elseif ($this->expandNextHash) {
|
||||
} else {
|
||||
$this->expandNextHash = false;
|
||||
$eol = ' class=sf-dump-expanded>';
|
||||
} else {
|
||||
$eol = '>';
|
||||
}
|
||||
|
||||
if ($hasChild) {
|
||||
$this->line .= '<samp';
|
||||
$this->line .= '<samp data-depth='.($cursor->depth + 1);
|
||||
if ($cursor->refIndex) {
|
||||
$r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2;
|
||||
$r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex;
|
||||
@@ -852,7 +834,7 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
|
||||
public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut)
|
||||
{
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
if ($hasChild) {
|
||||
@@ -864,7 +846,7 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function style($style, $value, $attr = [])
|
||||
protected function style(string $style, string $value, array $attr = [])
|
||||
{
|
||||
if ('' === $value) {
|
||||
return '';
|
||||
@@ -959,7 +941,7 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpLine($depth, $endOfValue = false)
|
||||
protected function dumpLine(int $depth, bool $endOfValue = false)
|
||||
{
|
||||
if (-1 === $this->lastDepth) {
|
||||
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
|
||||
|
@@ -32,8 +32,15 @@ if (!function_exists('dump')) {
|
||||
}
|
||||
|
||||
if (!function_exists('dd')) {
|
||||
/**
|
||||
* @return never
|
||||
*/
|
||||
function dd(...$vars)
|
||||
{
|
||||
if (!in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
|
||||
foreach ($vars as $v) {
|
||||
VarDumper::dump($v);
|
||||
}
|
||||
|
@@ -23,6 +23,10 @@ class Connection
|
||||
{
|
||||
private $host;
|
||||
private $contextProviders;
|
||||
|
||||
/**
|
||||
* @var resource|null
|
||||
*/
|
||||
private $socket;
|
||||
|
||||
/**
|
||||
|
10
vendor/symfony/var-dumper/Server/DumpServer.php
vendored
10
vendor/symfony/var-dumper/Server/DumpServer.php
vendored
@@ -25,9 +25,13 @@ use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
class DumpServer
|
||||
{
|
||||
private $host;
|
||||
private $socket;
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @var resource|null
|
||||
*/
|
||||
private $socket;
|
||||
|
||||
public function __construct(string $host, LoggerInterface $logger = null)
|
||||
{
|
||||
if (!str_contains($host, '://')) {
|
||||
@@ -52,6 +56,10 @@ class DumpServer
|
||||
}
|
||||
|
||||
foreach ($this->getMessages() as $clientId => $message) {
|
||||
if ($this->logger) {
|
||||
$this->logger->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
|
||||
}
|
||||
|
||||
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);
|
||||
|
||||
// Impossible to decode the message, give up.
|
||||
|
@@ -42,20 +42,17 @@ trait VarDumperTestTrait
|
||||
$this->varDumperConfig['flags'] = null;
|
||||
}
|
||||
|
||||
public function assertDumpEquals($expected, $data, $filter = 0, $message = '')
|
||||
public function assertDumpEquals($expected, $data, int $filter = 0, string $message = '')
|
||||
{
|
||||
$this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message);
|
||||
}
|
||||
|
||||
public function assertDumpMatchesFormat($expected, $data, $filter = 0, $message = '')
|
||||
public function assertDumpMatchesFormat($expected, $data, int $filter = 0, string $message = '')
|
||||
{
|
||||
$this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getDump($data, $key = null, $filter = 0)
|
||||
protected function getDump($data, $key = null, int $filter = 0): ?string
|
||||
{
|
||||
if (null === $flags = $this->varDumperConfig['flags']) {
|
||||
$flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
|
||||
|
77
vendor/symfony/var-dumper/VarDumper.php
vendored
77
vendor/symfony/var-dumper/VarDumper.php
vendored
@@ -11,12 +11,18 @@
|
||||
|
||||
namespace Symfony\Component\VarDumper;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
||||
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\CliContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextualizedDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\ServerDumper;
|
||||
|
||||
// Load the global dump() function
|
||||
require_once __DIR__.'/Resources/functions/dump.php';
|
||||
@@ -26,30 +32,23 @@ require_once __DIR__.'/Resources/functions/dump.php';
|
||||
*/
|
||||
class VarDumper
|
||||
{
|
||||
/**
|
||||
* @var callable|null
|
||||
*/
|
||||
private static $handler;
|
||||
|
||||
public static function dump($var)
|
||||
{
|
||||
if (null === self::$handler) {
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
|
||||
|
||||
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
|
||||
$dumper = 'html' === $_SERVER['VAR_DUMPER_FORMAT'] ? new HtmlDumper() : new CliDumper();
|
||||
} else {
|
||||
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper() : new HtmlDumper();
|
||||
}
|
||||
|
||||
$dumper = new ContextualizedDumper($dumper, [new SourceContextProvider()]);
|
||||
|
||||
self::$handler = function ($var) use ($cloner, $dumper) {
|
||||
$dumper->dump($cloner->cloneVar($var));
|
||||
};
|
||||
self::register();
|
||||
}
|
||||
|
||||
return (self::$handler)($var);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return callable|null
|
||||
*/
|
||||
public static function setHandler(callable $callable = null)
|
||||
{
|
||||
$prevHandler = self::$handler;
|
||||
@@ -63,4 +62,54 @@ class VarDumper
|
||||
|
||||
return $prevHandler;
|
||||
}
|
||||
|
||||
private static function register(): void
|
||||
{
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
|
||||
|
||||
$format = $_SERVER['VAR_DUMPER_FORMAT'] ?? null;
|
||||
switch (true) {
|
||||
case 'html' === $format:
|
||||
$dumper = new HtmlDumper();
|
||||
break;
|
||||
case 'cli' === $format:
|
||||
$dumper = new CliDumper();
|
||||
break;
|
||||
case 'server' === $format:
|
||||
case $format && 'tcp' === parse_url($format, \PHP_URL_SCHEME):
|
||||
$host = 'server' === $format ? $_SERVER['VAR_DUMPER_SERVER'] ?? '127.0.0.1:9912' : $format;
|
||||
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
|
||||
$dumper = new ServerDumper($host, $dumper, self::getDefaultContextProviders());
|
||||
break;
|
||||
default:
|
||||
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
|
||||
}
|
||||
|
||||
if (!$dumper instanceof ServerDumper) {
|
||||
$dumper = new ContextualizedDumper($dumper, [new SourceContextProvider()]);
|
||||
}
|
||||
|
||||
self::$handler = function ($var) use ($cloner, $dumper) {
|
||||
$dumper->dump($cloner->cloneVar($var));
|
||||
};
|
||||
}
|
||||
|
||||
private static function getDefaultContextProviders(): array
|
||||
{
|
||||
$contextProviders = [];
|
||||
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && class_exists(Request::class)) {
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push(Request::createFromGlobals());
|
||||
$contextProviders['request'] = new RequestContextProvider($requestStack);
|
||||
}
|
||||
|
||||
$fileLinkFormatter = class_exists(FileLinkFormatter::class) ? new FileLinkFormatter(null, $requestStack ?? null) : null;
|
||||
|
||||
return $contextProviders + [
|
||||
'cli' => new CliContextProvider(),
|
||||
'source' => new SourceContextProvider(null, null, $fileLinkFormatter),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
14
vendor/symfony/var-dumper/composer.json
vendored
14
vendor/symfony/var-dumper/composer.json
vendored
@@ -16,20 +16,20 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"php": ">=7.2.5",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/polyfill-php72": "~1.5",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-iconv": "*",
|
||||
"symfony/console": "^3.4|^4.0|^5.0",
|
||||
"symfony/process": "^4.4|^5.0",
|
||||
"twig/twig": "^1.43|^2.13|^3.0.4"
|
||||
"symfony/console": "^4.4|^5.0|^6.0",
|
||||
"symfony/process": "^4.4|^5.0|^6.0",
|
||||
"symfony/uid": "^5.1|^6.0",
|
||||
"twig/twig": "^2.13|^3.0.4"
|
||||
},
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
|
||||
"symfony/console": "<3.4"
|
||||
"phpunit/phpunit": "<5.4.3",
|
||||
"symfony/console": "<4.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
|
||||
|
Reference in New Issue
Block a user