Showing preview only (602K chars total). Download the full file or copy to clipboard to get everything.
Repository: symfony/var-dumper
Branch: 8.1
Commit: bbd278a21804
Files: 162
Total size: 560.8 KB
Directory structure:
gitextract_7b4gxnj_/
├── .gitattributes
├── .github/
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/
│ └── close-pull-request.yml
├── .gitignore
├── CHANGELOG.md
├── Caster/
│ ├── AddressInfoCaster.php
│ ├── AmqpCaster.php
│ ├── ArgsStub.php
│ ├── Caster.php
│ ├── ClassStub.php
│ ├── ConstStub.php
│ ├── CurlCaster.php
│ ├── CutArrayStub.php
│ ├── CutStub.php
│ ├── DOMCaster.php
│ ├── DateCaster.php
│ ├── DoctrineCaster.php
│ ├── DsCaster.php
│ ├── DsPairStub.php
│ ├── EnumStub.php
│ ├── ExceptionCaster.php
│ ├── FFICaster.php
│ ├── FiberCaster.php
│ ├── FrameStub.php
│ ├── GdCaster.php
│ ├── GmpCaster.php
│ ├── ImagineCaster.php
│ ├── ImgStub.php
│ ├── IntlCaster.php
│ ├── LinkStub.php
│ ├── MemcachedCaster.php
│ ├── MysqliCaster.php
│ ├── OpenSSLCaster.php
│ ├── PdoCaster.php
│ ├── PgSqlCaster.php
│ ├── ProxyManagerCaster.php
│ ├── RdKafkaCaster.php
│ ├── RedisCaster.php
│ ├── ReflectionCaster.php
│ ├── ResourceCaster.php
│ ├── ScalarStub.php
│ ├── SocketCaster.php
│ ├── SplCaster.php
│ ├── SqliteCaster.php
│ ├── StubCaster.php
│ ├── SymfonyCaster.php
│ ├── TraceStub.php
│ ├── UninitializedStub.php
│ ├── UuidCaster.php
│ ├── VirtualStub.php
│ ├── XmlReaderCaster.php
│ └── XmlResourceCaster.php
├── Cloner/
│ ├── AbstractCloner.php
│ ├── ClonerInterface.php
│ ├── Cursor.php
│ ├── Data.php
│ ├── DumperInterface.php
│ ├── Stub.php
│ └── VarCloner.php
├── Command/
│ ├── Descriptor/
│ │ ├── CliDescriptor.php
│ │ ├── DumpDescriptorInterface.php
│ │ └── HtmlDescriptor.php
│ └── ServerDumpCommand.php
├── Dumper/
│ ├── AbstractDumper.php
│ ├── CliDumper.php
│ ├── ContextProvider/
│ │ ├── CliContextProvider.php
│ │ ├── ContextProviderInterface.php
│ │ ├── RequestContextProvider.php
│ │ └── SourceContextProvider.php
│ ├── ContextualizedDumper.php
│ ├── DataDumperInterface.php
│ ├── HtmlDumper.php
│ └── ServerDumper.php
├── Exception/
│ └── ThrowingCasterException.php
├── LICENSE
├── README.md
├── Resources/
│ ├── bin/
│ │ └── var-dump-server
│ ├── css/
│ │ └── htmlDescriptor.css
│ ├── functions/
│ │ └── dump.php
│ └── js/
│ └── htmlDescriptor.js
├── Server/
│ ├── Connection.php
│ └── DumpServer.php
├── Test/
│ └── VarDumperTestTrait.php
├── Tests/
│ ├── Caster/
│ │ ├── AddressInfoCasterTest.php
│ │ ├── CasterTest.php
│ │ ├── CurlCasterTest.php
│ │ ├── DOMCasterTest.php
│ │ ├── DateCasterTest.php
│ │ ├── DoctrineCasterTest.php
│ │ ├── ExceptionCasterTest.php
│ │ ├── FFICasterTest.php
│ │ ├── FiberCasterTest.php
│ │ ├── GmpCasterTest.php
│ │ ├── IntlCasterTest.php
│ │ ├── MemcachedCasterTest.php
│ │ ├── MysqliCasterTest.php
│ │ ├── OpenSSLCasterTest.php
│ │ ├── PdoCasterTest.php
│ │ ├── RdKafkaCasterTest.php
│ │ ├── RedisCasterTest.php
│ │ ├── ReflectionCasterTest.php
│ │ ├── ResourceCasterTest.php
│ │ ├── SocketCasterTest.php
│ │ ├── SplCasterTest.php
│ │ ├── SqliteCasterTest.php
│ │ ├── StubCasterTest.php
│ │ ├── SymfonyCasterTest.php
│ │ └── XmlReaderCasterTest.php
│ ├── Cloner/
│ │ ├── DataTest.php
│ │ ├── StubTest.php
│ │ └── VarClonerTest.php
│ ├── Command/
│ │ ├── Descriptor/
│ │ │ ├── CliDescriptorTest.php
│ │ │ └── HtmlDescriptorTest.php
│ │ └── ServerDumpCommandTest.php
│ ├── Dumper/
│ │ ├── CliDumperTest.php
│ │ ├── ContextProvider/
│ │ │ └── RequestContextProviderTest.php
│ │ ├── ContextualizedDumperTest.php
│ │ ├── FunctionsTest.php
│ │ ├── HtmlDumperTest.php
│ │ ├── ServerDumperTest.php
│ │ └── functions/
│ │ ├── dd_with_accept_header_json_array.phpt
│ │ ├── dd_with_multiple_args.phpt
│ │ ├── dd_with_named_args.phpt
│ │ ├── dd_with_null.phpt
│ │ ├── dd_with_single_arg.phpt
│ │ ├── dump_data_collector_with_spl_array.phpt
│ │ ├── dump_with_accept_header_html.phpt
│ │ ├── dump_with_accept_header_json_array.phpt
│ │ ├── dump_with_accept_header_json_multiple_args.phpt
│ │ ├── dump_with_accept_header_json_string.phpt
│ │ ├── dump_with_accept_header_wildcard.phpt
│ │ ├── dump_with_multiple_args.phpt
│ │ ├── dump_with_named_args.phpt
│ │ ├── dump_with_null.phpt
│ │ ├── dump_with_single_arg.phpt
│ │ └── dump_without_args.phpt
│ ├── Fixtures/
│ │ ├── BackedEnumFixture.php
│ │ ├── DateTimeChild.php
│ │ ├── ExtendsReflectionTypeFixture.php
│ │ ├── FooInterface.php
│ │ ├── GeneratorDemo.php
│ │ ├── LotsOfAttributes.php
│ │ ├── MyAttribute.php
│ │ ├── NotLoadableClass.php
│ │ ├── Php74.php
│ │ ├── Php81Enums.php
│ │ ├── Php82NullStandaloneReturnType.php
│ │ ├── ReflectionIntersectionTypeFixture.php
│ │ ├── ReflectionNamedTypeFixture.php
│ │ ├── ReflectionUnionTypeFixture.php
│ │ ├── ReflectionUnionTypeWithIntersectionFixture.php
│ │ ├── Twig.php
│ │ ├── UnitEnumFixture.php
│ │ ├── VirtualProperty.php
│ │ ├── dumb-var.php
│ │ ├── dump_server.php
│ │ └── xml_reader.xml
│ ├── Server/
│ │ └── ConnectionTest.php
│ └── Test/
│ └── VarDumperTestTraitTest.php
├── VarDumper.php
├── composer.json
└── phpunit.xml.dist
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.git* export-ignore
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
Please do not submit any Pull Requests here. They will be closed.
---
Please submit your PR here instead:
https://github.com/symfony/symfony
This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
================================================
FILE: .github/workflows/close-pull-request.yml
================================================
name: Close Pull Request
on:
pull_request_target:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: |
Thanks for your Pull Request! We love contributions.
However, you should instead open your PR on the main repository:
https://github.com/symfony/symfony
This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
================================================
FILE: .gitignore
================================================
composer.lock
phpunit.xml
vendor/
================================================
FILE: CHANGELOG.md
================================================
CHANGELOG
=========
7.4
---
* Add support for adding more default casters to `AbstractCloner::addDefaultCasters()`
* Select HtmlDumper only if `Accept` header contains "html"
7.3
---
* Add casters for `Dba\Connection`, `SQLite3Result`, `OpenSSLAsymmetricKey` and `OpenSSLCertificateSigningRequest`
* Deprecate `ResourceCaster::castCurl()`, `ResourceCaster::castGd()` and `ResourceCaster::castOpensslX509()`
* Mark all casters as `@internal`
7.2
---
* Add support for `FORCE_COLOR` environment variable
* Add support for virtual properties
7.1
---
* Add support for new DOM extension classes in `DOMCaster`
7.0
---
* Add argument `$label` to `VarDumper::dump()`
* Require explicit argument when calling `VarDumper::setHandler()`
* Remove display of backtrace in `Twig_Template`, only `Twig\Template` is supported
6.4
---
* Dump uninitialized properties
6.3
---
* Add caster for `WeakMap`
* Add support of named arguments to `dd()` and `dump()` to display the argument name
* Add support for `Relay\Relay`
* Add display of invisible characters
6.2
---
* Add support for `FFI\CData` and `FFI\CType`
* Deprecate calling `VarDumper::setHandler()` without arguments
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
-----
* added `VarDumperTestTrait::setUpVarDumper()` and `VarDumperTestTrait::tearDownVarDumper()`
to configure casters & flags to use in tests
* added `ImagineCaster` and infrastructure to dump images
* added the stamps of a message after it is dispatched in `TraceableMessageBus` and `MessengerDataCollector` collected data
* added `UuidCaster`
* made all casters final
* added support for the `NO_COLOR` env var (https://no-color.org/)
4.3.0
-----
* added `DsCaster` to support dumping the contents of data structures from the Ds extension
4.2.0
-----
* support selecting the format to use by setting the environment variable `VAR_DUMPER_FORMAT` to `html` or `cli`
4.1.0
-----
* added a `ServerDumper` to send serialized Data clones to a server
* added a `ServerDumpCommand` and `DumpServer` to run a server collecting
and displaying dumps on a single place with multiple formats support
* added `CliDescriptor` and `HtmlDescriptor` descriptors for `server:dump` CLI and HTML formats support
4.0.0
-----
* support for passing `\ReflectionClass` instances to the `Caster::castObject()`
method has been dropped, pass class names as strings instead
* the `Data::getRawData()` method has been removed
* the `VarDumperTestTrait::assertDumpEquals()` method expects a 3rd `$filter = 0`
argument and moves `$message = ''` argument at 4th position.
* the `VarDumperTestTrait::assertDumpMatchesFormat()` method expects a 3rd `$filter = 0`
argument and moves `$message = ''` argument at 4th position.
3.4.0
-----
* added `AbstractCloner::setMinDepth()` function to ensure minimum tree depth
* deprecated `MongoCaster`
2.7.0
-----
* deprecated `Cloner\Data::getLimitedClone()`. Use `withMaxDepth`, `withMaxItemsPerDepth` or `withRefHandles` instead.
================================================
FILE: Caster/AddressInfoCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class AddressInfoCaster
{
private const MAPS = [
'ai_flags' => [
1 => 'AI_PASSIVE',
2 => 'AI_CANONNAME',
4 => 'AI_NUMERICHOST',
8 => 'AI_V4MAPPED',
16 => 'AI_ALL',
32 => 'AI_ADDRCONFIG',
64 => 'AI_IDN',
128 => 'AI_CANONIDN',
1024 => 'AI_NUMERICSERV',
],
'ai_family' => [
1 => 'AF_UNIX',
2 => 'AF_INET',
10 => 'AF_INET6',
44 => 'AF_DIVERT',
],
'ai_socktype' => [
1 => 'SOCK_STREAM',
2 => 'SOCK_DGRAM',
3 => 'SOCK_RAW',
4 => 'SOCK_RDM',
5 => 'SOCK_SEQPACKET',
],
'ai_protocol' => [
1 => 'SOL_SOCKET',
6 => 'SOL_TCP',
17 => 'SOL_UDP',
136 => 'SOL_UDPLITE',
],
];
public static function castAddressInfo(\AddressInfo $h, array $a, Stub $stub, bool $isNested): array
{
static $resolvedMaps;
if (!$resolvedMaps) {
foreach (self::MAPS as $k => $map) {
foreach ($map as $v => $name) {
if (\defined($name)) {
$resolvedMaps[$k][\constant($name)] = $name;
} elseif (!isset($resolvedMaps[$k][$v])) {
$resolvedMaps[$k][$v] = $name;
}
}
}
}
foreach (socket_addrinfo_explain($h) as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = match (true) {
'ai_flags' === $k => ConstStub::fromBitfield($v, $resolvedMaps[$k]),
isset($resolvedMaps[$k][$v]) => new ConstStub($resolvedMaps[$k][$v], $v),
default => $v,
};
}
return $a;
}
}
================================================
FILE: Caster/AmqpCaster.php
================================================
<?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 Amqp related classes to array representation.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final
*
* @internal
*/
class AmqpCaster
{
private const FLAGS = [
\AMQP_DURABLE => 'AMQP_DURABLE',
\AMQP_PASSIVE => 'AMQP_PASSIVE',
\AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
\AMQP_AUTODELETE => 'AMQP_AUTODELETE',
\AMQP_INTERNAL => 'AMQP_INTERNAL',
\AMQP_NOLOCAL => 'AMQP_NOLOCAL',
\AMQP_AUTOACK => 'AMQP_AUTOACK',
\AMQP_IFEMPTY => 'AMQP_IFEMPTY',
\AMQP_IFUNUSED => 'AMQP_IFUNUSED',
\AMQP_MANDATORY => 'AMQP_MANDATORY',
\AMQP_IMMEDIATE => 'AMQP_IMMEDIATE',
\AMQP_MULTIPLE => 'AMQP_MULTIPLE',
\AMQP_NOWAIT => 'AMQP_NOWAIT',
\AMQP_REQUEUE => 'AMQP_REQUEUE',
];
private const EXCHANGE_TYPES = [
\AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT',
\AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
\AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
\AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
];
public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'is_connected' => $c->isConnected(),
];
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPConnection\x00login"])) {
return $a;
}
// BC layer in the amqp lib
if (method_exists($c, 'getReadTimeout')) {
$timeout = $c->getReadTimeout();
} else {
$timeout = $c->getTimeout();
}
$a += [
$prefix.'is_connected' => $c->isConnected(),
$prefix.'login' => $c->getLogin(),
$prefix.'password' => $c->getPassword(),
$prefix.'host' => $c->getHost(),
$prefix.'vhost' => $c->getVhost(),
$prefix.'port' => $c->getPort(),
$prefix.'read_timeout' => $timeout,
];
return $a;
}
public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'is_connected' => $c->isConnected(),
$prefix.'channel_id' => $c->getChannelId(),
];
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPChannel\x00connection"])) {
return $a;
}
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'prefetch_size' => $c->getPrefetchSize(),
$prefix.'prefetch_count' => $c->getPrefetchCount(),
];
return $a;
}
public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
];
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPQueue\x00name"])) {
return $a;
}
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'arguments' => $c->getArguments(),
];
return $a;
}
public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
];
$type = isset(self::EXCHANGE_TYPES[$c->getType()]) ? new ConstStub(self::EXCHANGE_TYPES[$c->getType()], $c->getType()) : $c->getType();
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPExchange\x00name"])) {
$a["\x00AMQPExchange\x00type"] = $type;
return $a;
}
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'type' => $type,
$prefix.'arguments' => $c->getArguments(),
];
return $a;
}
public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPEnvelope\x00body"])) {
$a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode;
return $a;
}
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$a += [$prefix.'body' => $c->getBody()];
}
$a += [
$prefix.'delivery_tag' => $c->getDeliveryTag(),
$prefix.'is_redelivery' => $c->isRedelivery(),
$prefix.'exchange_name' => $c->getExchangeName(),
$prefix.'routing_key' => $c->getRoutingKey(),
$prefix.'content_type' => $c->getContentType(),
$prefix.'content_encoding' => $c->getContentEncoding(),
$prefix.'headers' => $c->getHeaders(),
$prefix.'delivery_mode' => $deliveryMode,
$prefix.'priority' => $c->getPriority(),
$prefix.'correlation_id' => $c->getCorrelationId(),
$prefix.'reply_to' => $c->getReplyTo(),
$prefix.'expiration' => $c->getExpiration(),
$prefix.'message_id' => $c->getMessageId(),
$prefix.'timestamp' => $c->getTimeStamp(),
$prefix.'type' => $c->getType(),
$prefix.'user_id' => $c->getUserId(),
$prefix.'app_id' => $c->getAppId(),
];
return $a;
}
private static function extractFlags(int $flags): ConstStub
{
$flagsArray = [];
foreach (self::FLAGS as $value => $name) {
if ($flags & $value) {
$flagsArray[] = $name;
}
}
if (!$flagsArray) {
$flagsArray = ['AMQP_NOPARAM'];
}
return new ConstStub(implode('|', $flagsArray), $flags);
}
}
================================================
FILE: Caster/ArgsStub.php
================================================
<?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;
/**
* Represents a list of function arguments.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class ArgsStub extends EnumStub
{
private static array $parameters = [];
public function __construct(array $args, string $function, ?string $class)
{
[$variadic, $params] = self::getParameters($function, $class);
$values = [];
foreach ($args as $k => $v) {
$values[$k] = !\is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
}
if (null === $params) {
parent::__construct($values, false);
return;
}
if (\count($values) < \count($params)) {
$params = \array_slice($params, 0, \count($values));
} elseif (\count($values) > \count($params)) {
$values[] = new EnumStub(array_splice($values, \count($params)), false);
$params[] = $variadic;
}
if (['...'] === $params) {
parent::__construct($values[0]->value, false);
} else {
parent::__construct(array_combine($params, $values));
}
}
private static function getParameters(string $function, ?string $class): array
{
if (isset(self::$parameters[$k = $class.'::'.$function])) {
return self::$parameters[$k];
}
try {
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
} catch (\ReflectionException) {
return [null, null];
}
$variadic = '...';
$params = [];
foreach ($r->getParameters() as $v) {
$k = '$'.$v->name;
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
if ($v->isVariadic()) {
$variadic .= $k;
} else {
$params[] = $k;
}
}
return self::$parameters[$k] = [$variadic, $params];
}
}
================================================
FILE: Caster/Caster.php
================================================
<?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;
/**
* Helper for filtering out properties in casters.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class Caster
{
public const EXCLUDE_VERBOSE = 1;
public const EXCLUDE_VIRTUAL = 2;
public const EXCLUDE_DYNAMIC = 4;
public const EXCLUDE_PUBLIC = 8;
public const EXCLUDE_PROTECTED = 16;
public const EXCLUDE_PRIVATE = 32;
public const EXCLUDE_NULL = 64;
public const EXCLUDE_EMPTY = 128;
public const EXCLUDE_NOT_IMPORTANT = 256;
public const EXCLUDE_STRICT = 512;
public const EXCLUDE_UNINITIALIZED = 1024;
public const PREFIX_VIRTUAL = "\0~\0";
public const PREFIX_DYNAMIC = "\0+\0";
public const PREFIX_PROTECTED = "\0*\0";
// usage: sprintf(Caster::PATTERN_PRIVATE, $class, $property)
public const PATTERN_PRIVATE = "\0%s\0%s";
private static array $classProperties = [];
/**
* Casts objects to arrays and adds the dynamic property prefix.
*
* @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not
*
* @internal
*/
public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, ?string $debugClass = null): array
{
if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Throwable) {
// ignore failing __debugInfo()
$hasDebugInfo = false;
}
}
$a = $obj instanceof \Closure ? [] : (array) $obj;
if ($obj instanceof \__PHP_Incomplete_Class) {
return $a;
}
$classProperties = self::$classProperties[$class] ??= self::getClassProperties(new \ReflectionClass($class));
$a = array_replace($classProperties, $a);
if ($a) {
$debugClass ??= get_debug_type($obj);
$i = 0;
$prefixedKeys = [];
foreach ($a as $k => $v) {
if ("\0" !== ($k[0] ?? '')) {
if (!isset($classProperties[$k])) {
$prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k;
}
} elseif ($debugClass !== $class && 1 === strpos($k, $class)) {
$prefixedKeys[$i] = "\0".$debugClass.strrchr($k, "\0");
}
++$i;
}
if ($prefixedKeys) {
$keys = array_keys($a);
foreach ($prefixedKeys as $i => $k) {
$keys[$i] = $k;
}
$a = array_combine($keys, $a);
}
}
if ($hasDebugInfo && \is_array($debugInfo)) {
foreach ($debugInfo as $k => $v) {
if (!isset($k[0]) || "\0" !== $k[0]) {
if (\array_key_exists(self::PREFIX_DYNAMIC.$k, $a)) {
continue;
}
$k = self::PREFIX_VIRTUAL.$k;
}
unset($a[$k]);
$a[$k] = $v;
}
}
return $a;
}
/**
* Filters out the specified properties.
*
* By default, a single match in the $filter bit field filters properties out, following an "or" logic.
* When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed.
*
* @param array $a The array containing the properties to filter
* @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|null &$count Set to the number of removed properties
*/
public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array
{
$count = 0;
foreach ($a as $k => $v) {
$type = self::EXCLUDE_STRICT & $filter;
if (null === $v) {
$type |= self::EXCLUDE_NULL & $filter;
$type |= self::EXCLUDE_EMPTY & $filter;
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) {
$type |= self::EXCLUDE_EMPTY & $filter;
} elseif ($v instanceof UninitializedStub) {
$type |= self::EXCLUDE_UNINITIALIZED & $filter;
}
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_NOT_IMPORTANT;
}
if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_VERBOSE;
}
if (!isset($k[1]) || "\0" !== $k[0]) {
$type |= self::EXCLUDE_PUBLIC & $filter;
} elseif ('~' === $k[1]) {
$type |= self::EXCLUDE_VIRTUAL & $filter;
} elseif ('+' === $k[1]) {
$type |= self::EXCLUDE_DYNAMIC & $filter;
} elseif ('*' === $k[1]) {
$type |= self::EXCLUDE_PROTECTED & $filter;
} else {
$type |= self::EXCLUDE_PRIVATE & $filter;
}
if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
unset($a[$k]);
++$count;
}
}
return $a;
}
/**
* @internal
*/
public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array
{
if (isset($a['__PHP_Incomplete_Class_Name'])) {
$stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
unset($a['__PHP_Incomplete_Class_Name']);
}
return $a;
}
private static function getClassProperties(\ReflectionClass $class): array
{
$classProperties = [];
$className = $class->name;
if ($parent = $class->getParentClass()) {
$classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent);
}
foreach ($class->getProperties() as $p) {
if ($p->isStatic()) {
continue;
}
$classProperties[match (true) {
$p->isPublic() => $p->name,
$p->isProtected() => self::PREFIX_PROTECTED.$p->name,
default => "\0".$className."\0".$p->name,
}] = $p->isVirtual() ? new VirtualStub($p) : new UninitializedStub($p);
}
return $classProperties;
}
}
================================================
FILE: Caster/ClassStub.php
================================================
<?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;
/**
* Represents a PHP class identifier.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class ClassStub extends ConstStub
{
/**
* @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name
* @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier
*/
public function __construct(string $identifier, callable|array|string|null $callable = null)
{
$this->value = $identifier;
try {
if (null !== $callable) {
if ($callable instanceof \Closure) {
$r = new \ReflectionFunction($callable);
} elseif (\is_object($callable)) {
$r = [$callable, '__invoke'];
} elseif (\is_array($callable)) {
$r = $callable;
} elseif (false !== $i = strpos($callable, '::')) {
$r = [substr($callable, 0, $i), substr($callable, 2 + $i)];
} else {
$r = new \ReflectionFunction($callable);
}
} elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) {
$r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)];
} else {
$r = new \ReflectionClass($identifier);
}
if (\is_array($r)) {
try {
$r = new \ReflectionMethod($r[0], $r[1]);
} catch (\ReflectionException) {
$r = new \ReflectionClass($r[0]);
}
}
if (str_contains($identifier, "@anonymous\0")) {
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', static fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $identifier);
}
if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) {
$s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true, Caster::EXCLUDE_VERBOSE);
$s = ReflectionCaster::getSignature($s);
if (str_ends_with($identifier, '()')) {
$this->value = substr_replace($identifier, $s, -2);
} else {
$this->value .= $s;
}
}
} catch (\ReflectionException) {
return;
} finally {
if (0 < $i = strrpos($this->value, '\\')) {
$this->attr['ellipsis'] = \strlen($this->value) - $i;
$this->attr['ellipsis-type'] = 'class';
$this->attr['ellipsis-tail'] = 1;
}
}
if ($f = $r->getFileName()) {
$this->attr['file'] = $f;
$this->attr['line'] = $r->getStartLine();
}
}
public static function wrapCallable(mixed $callable): mixed
{
if (\is_object($callable) || !\is_callable($callable)) {
return $callable;
}
if (!\is_array($callable)) {
$callable = new static($callable, $callable);
} elseif (\is_string($callable[0])) {
$callable[0] = new static($callable[0], $callable);
} else {
$callable[1] = new static($callable[1], $callable);
}
return $callable;
}
}
================================================
FILE: Caster/ConstStub.php
================================================
<?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;
/**
* Represents a PHP constant and its value.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class ConstStub extends Stub
{
public function __construct(string $name, string|int|float|null $value = null)
{
$this->class = $name;
$this->value = 1 < \func_num_args() ? $value : $name;
}
public function __toString(): string
{
return (string) $this->value;
}
/**
* @param array<int, string> $values
*/
public static function fromBitfield(int $value, array $values): self
{
$names = [];
foreach ($values as $v => $name) {
if ($value & $v) {
$names[] = $name;
}
}
if (!$names) {
$names[] = $values[0] ?? 0;
}
return new self(implode(' | ', $names), $value);
}
}
================================================
FILE: Caster/CurlCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class CurlCaster
{
public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array
{
foreach (curl_getinfo($h) as $key => $val) {
$a[Caster::PREFIX_VIRTUAL.$key] = $val;
}
return $a;
}
}
================================================
FILE: Caster/CutArrayStub.php
================================================
<?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;
/**
* Represents a cut array.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class CutArrayStub extends CutStub
{
public array $preservedSubset;
public function __construct(array $value, array $preservedKeys)
{
parent::__construct($value);
$this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys));
$this->cut -= \count($this->preservedSubset);
}
}
================================================
FILE: Caster/CutStub.php
================================================
<?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;
/**
* Represents the main properties of a PHP variable, pre-casted by a caster.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class CutStub extends Stub
{
public function __construct(mixed $value)
{
$this->value = $value;
switch (\gettype($value)) {
case 'object':
$this->type = self::TYPE_OBJECT;
$this->class = get_debug_type($value);
if ($value instanceof \Closure) {
ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE);
}
$this->cut = -1;
break;
case 'array':
$this->type = self::TYPE_ARRAY;
$this->class = self::ARRAY_ASSOC;
$this->cut = $this->value = \count($value);
break;
case 'resource':
case 'unknown type':
case 'resource (closed)':
$this->type = self::TYPE_RESOURCE;
$this->handle = (int) $value;
if ('Unknown' === $this->class = @get_resource_type($value)) {
$this->class = 'Closed';
}
$this->cut = -1;
break;
case 'string':
$this->type = self::TYPE_STRING;
$this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
$this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8');
$this->value = '';
break;
}
}
}
================================================
FILE: Caster/DOMCaster.php
================================================
<?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 DOM related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class DOMCaster
{
private const ERROR_CODES = [
0 => 'DOM_PHP_ERR',
\DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
\DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
\DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
\DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR',
\DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR',
\DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR',
\DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR',
\DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR',
\DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR',
\DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR',
\DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR',
\DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR',
\DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR',
\DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
\DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
\DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
];
private const NODE_TYPES = [
\XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
\XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
\XML_TEXT_NODE => 'XML_TEXT_NODE',
\XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE',
\XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE',
\XML_ENTITY_NODE => 'XML_ENTITY_NODE',
\XML_PI_NODE => 'XML_PI_NODE',
\XML_COMMENT_NODE => 'XML_COMMENT_NODE',
\XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE',
\XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE',
\XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE',
\XML_NOTATION_NODE => 'XML_NOTATION_NODE',
\XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE',
\XML_DTD_NODE => 'XML_DTD_NODE',
\XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE',
\XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
\XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
\XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
];
public static function castException(\DOMException|\Dom\Exception $e, array $a, Stub $stub, bool $isNested): array
{
$k = Caster::PREFIX_PROTECTED.'code';
if (isset($a[$k], self::ERROR_CODES[$a[$k]])) {
$a[$k] = new ConstStub(self::ERROR_CODES[$a[$k]], $a[$k]);
}
return $a;
}
public static function castLength($dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castImplementation(\DOMImplementation|\Dom\Implementation $dom, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
Caster::PREFIX_VIRTUAL.'XML' => '2.0',
];
return $a;
}
public static function castNode(\DOMNode|\Dom\Node $dom, array $a, Stub $stub, bool $isNested): array
{
return self::castDom($dom, $a, $stub, $isNested);
}
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested): array
{
return self::castDom($dom, $a, $stub, $isNested);
}
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$formatOutput = $dom->formatOutput;
$dom->formatOutput = true;
$a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()];
$dom->formatOutput = $formatOutput;
}
return $a;
}
public static function castXMLDocument(\Dom\XMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$formatOutput = $dom->formatOutput;
$dom->formatOutput = true;
$a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()];
$dom->formatOutput = $formatOutput;
}
return $a;
}
public static function castHTMLDocument(\Dom\HTMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$a += [Caster::PREFIX_VIRTUAL.'html' => $dom->saveHTML()];
}
return $a;
}
public static function castCharacterData(\DOMCharacterData|\Dom\CharacterData $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castAttr(\DOMAttr|\Dom\Attr $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castElement(\DOMElement|\Dom\Element $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castText(\DOMText|\Dom\Text $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castDocumentType(\DOMDocumentType|\Dom\DocumentType $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castNotation(\DOMNotation|\Dom\Notation $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castEntity(\DOMEntity|\Dom\Entity $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castProcessingInstruction(\DOMProcessingInstruction|\Dom\ProcessingInstruction $dom, array $a, Stub $stub, bool $isNested): array
{
return $a;
}
public static function castXPath(\DOMXPath|\Dom\XPath $dom, array $a, Stub $stub, bool $isNested): array
{
return self::castDom($dom, $a, $stub, $isNested);
}
public static function castDom($dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
foreach ($a as $k => $v) {
if ('encoding' === $k && $dom instanceof \DOMEntity
|| \in_array($k, ['actualEncoding', 'config', 'standalone', 'version'], true)
) {
continue; // deprecated properties
}
$v = $dom->$k;
$a[$k] = match (true) {
$v instanceof \DOMNode || $v instanceof \Dom\Node => new CutStub($v),
'nodeType' === $k => new ConstStub(self::NODE_TYPES[$v], $v),
'baseURI' === $k && $v,
'documentURI' === $k && $v => new LinkStub($v),
default => $v,
};
}
if ($dom instanceof \IteratorAggregate) {
foreach ($dom as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
}
return $a;
}
}
================================================
FILE: Caster/DateCaster.php
================================================
<?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 DateTimeInterface related classes to array representation.
*
* @author Dany Maillard <danymaillard93b@gmail.com>
*
* @final
*
* @internal
*/
class DateCaster
{
private const PERIOD_LIMIT = 3;
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null;
$fromNow = (new \DateTimeImmutable())->diff($d);
$title = $d->format('l, F j, Y')
."\n".self::formatInterval($fromNow).' from now'
.($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
;
unset(
$a[Caster::PREFIX_DYNAMIC.'date'],
$a[Caster::PREFIX_DYNAMIC.'timezone'],
$a[Caster::PREFIX_DYNAMIC.'timezone_type']
);
$a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title);
$stub->class .= $d->format(' @U');
return $a;
}
public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter): array
{
$now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
$title = number_format($numberOfSeconds, 0, '.', ' ').'s';
$i = [Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title)];
return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a;
}
private static function formatInterval(\DateInterval $i): string
{
$format = '%R ';
if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) {
$d = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$i = $d->diff($d->add($i)); // recalculate carry over points
$format .= 0 < $i->days ? '%ad ' : '';
} else {
$format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : '');
}
$format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:'.self::formatSeconds($i->s, substr($i->f, 2)) : '';
$format = '%R ' === $format ? '0s' : $format;
return $i->format(rtrim($format));
}
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter): array
{
$location = $timeZone->getLocation();
$formatted = (new \DateTimeImmutable('now', $timeZone))->format($location ? 'e (P)' : 'P');
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
$z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)];
return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
}
public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $isNested, int $filter): array
{
$dates = [];
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(
'every %s, from %s%s %s',
self::formatInterval($p->getDateInterval()),
$p->include_start_date ? '[' : ']',
self::formatDateTime($p->getStartDate()),
($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end).($p->include_end_date ? ']' : '[') : 'recurring '.$p->recurrences.' time/s'
);
$p = [Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))];
return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a;
}
private static function formatDateTime(\DateTimeInterface $d, string $extra = ''): string
{
return $d->format('Y-m-d H:i:'.self::formatSeconds($d->format('s'), $d->format('u')).$extra);
}
private static function formatSeconds(string $s, string $us): string
{
return \sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
}
}
================================================
FILE: Caster/DoctrineCaster.php
================================================
<?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 Doctrine\Common\Proxy\Proxy as CommonProxy;
use Doctrine\ORM\PersistentCollection;
use Doctrine\ORM\Proxy\Proxy as OrmProxy;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts Doctrine related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested): array
{
foreach (['__cloner__', '__initializer__'] as $k) {
if (\array_key_exists($k, $a)) {
unset($a[$k]);
++$stub->cut;
}
}
return $a;
}
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested): array
{
foreach (['_entityPersister', '_identifier'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
unset($a[$k]);
++$stub->cut;
}
}
return $a;
}
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested): array
{
foreach (['snapshot', 'association', 'typeClass'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
$a[$k] = new CutStub($a[$k]);
}
}
return $a;
}
}
================================================
FILE: Caster/DsCaster.php
================================================
<?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 Ds\Collection;
use Ds\Map;
use Ds\Pair;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts Ds extension classes to array representation.
*
* @author Jáchym Toušek <enumag@gmail.com>
*
* @final
*/
class DsCaster
{
public static function castCollection(Collection $c, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'count'] = $c->count();
$a[Caster::PREFIX_VIRTUAL.'capacity'] = $c->capacity();
if (!$c instanceof Map) {
$a += $c->toArray();
}
return $a;
}
public static function castMap(Map $c, array $a, Stub $stub, bool $isNested): array
{
foreach ($c as $k => $v) {
$a[] = new DsPairStub($k, $v);
}
return $a;
}
public static function castPair(Pair $c, array $a, Stub $stub, bool $isNested): array
{
foreach ($c->toArray() as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
return $a;
}
public static function castPairStub(DsPairStub $c, array $a, Stub $stub, bool $isNested): array
{
if ($isNested) {
$stub->class = Pair::class;
$stub->value = null;
$stub->handle = 0;
$a = $c->value;
}
return $a;
}
}
================================================
FILE: Caster/DsPairStub.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class DsPairStub extends Stub
{
public function __construct(mixed $key, mixed $value)
{
$this->value = [
Caster::PREFIX_VIRTUAL.'key' => $key,
Caster::PREFIX_VIRTUAL.'value' => $value,
];
}
}
================================================
FILE: Caster/EnumStub.php
================================================
<?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;
/**
* Represents an enumeration of values.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class EnumStub extends Stub
{
public function __construct(
array $values,
public bool $dumpKeys = true,
) {
$this->value = $values;
}
}
================================================
FILE: Caster/ExceptionCaster.php
================================================
<?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\ErrorHandler\Exception\FlattenException;
use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
/**
* Casts common Exception classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class ExceptionCaster
{
public static int $srcContext = 1;
public static bool $traceArgs = true;
public static array $errorTypes = [
\E_DEPRECATED => 'E_DEPRECATED',
\E_USER_DEPRECATED => 'E_USER_DEPRECATED',
\E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
\E_ERROR => 'E_ERROR',
\E_WARNING => 'E_WARNING',
\E_PARSE => 'E_PARSE',
\E_NOTICE => 'E_NOTICE',
\E_CORE_ERROR => 'E_CORE_ERROR',
\E_CORE_WARNING => 'E_CORE_WARNING',
\E_COMPILE_ERROR => 'E_COMPILE_ERROR',
\E_COMPILE_WARNING => 'E_COMPILE_WARNING',
\E_USER_ERROR => 'E_USER_ERROR',
\E_USER_WARNING => 'E_USER_WARNING',
\E_USER_NOTICE => 'E_USER_NOTICE',
2048 => 'E_STRICT',
];
private static array $framesCache = [];
public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
}
public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
}
public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested): array
{
if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
}
return $a;
}
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested): array
{
$trace = Caster::PREFIX_VIRTUAL.'trace';
$prefix = Caster::PREFIX_PROTECTED;
$xPrefix = "\0Exception\0";
if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
$class = get_debug_type($a[$xPrefix.'previous']);
self::traceUnshift($b[$xPrefix.'trace'], $class, $b[$prefix.'file'], $b[$prefix.'line']);
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value));
}
unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
return $a;
}
public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested): array
{
$sPrefix = "\0".SilencedErrorContext::class."\0";
if (!isset($a[$s = $sPrefix.'severity'])) {
return $a;
}
if (isset(self::$errorTypes[$a[$s]])) {
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
}
$trace = [[
'file' => $a[$sPrefix.'file'],
'line' => $a[$sPrefix.'line'],
]];
if (isset($a[$sPrefix.'trace'])) {
$trace = array_merge($trace, $a[$sPrefix.'trace']);
}
unset($a[$sPrefix.'file'], $a[$sPrefix.'line'], $a[$sPrefix.'trace']);
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
return $a;
}
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested): array
{
if (!$isNested) {
return $a;
}
$stub->class = '';
$stub->handle = 0;
$frames = $trace->value;
$prefix = Caster::PREFIX_VIRTUAL;
$a = [];
$j = \count($frames);
if (0 > $i = $trace->sliceOffset) {
$i = max(0, $j + $i);
}
if (!isset($trace->value[$i])) {
return [];
}
$lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
$frames[] = ['function' => ''];
$collapse = false;
for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
$f = $frames[$i];
$call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???';
$frame = new FrameStub(
[
'object' => $f['object'] ?? null,
'class' => $f['class'] ?? null,
'type' => $f['type'] ?? null,
'function' => $f['function'] ?? null,
] + $frames[$i - 1],
false,
true
);
$f = self::castFrameStub($frame, [], $frame, true);
if (isset($f[$prefix.'src'])) {
foreach ($f[$prefix.'src']->value as $label => $frame) {
if (str_starts_with($label, "\0~collapse=0")) {
if ($collapse) {
$label = substr_replace($label, '1', 11, 1);
} else {
$collapse = true;
}
}
$label = substr_replace($label, "title=Stack level $j.&", 2, 0);
}
$f = $frames[$i - 1];
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
$frame->value['arguments'] = new ArgsStub($f['args'], $f['function'] ?? null, $f['class'] ?? null);
}
} elseif ('???' !== $lastCall) {
$label = new ClassStub($lastCall);
if (isset($label->attr['ellipsis'])) {
$label->attr['ellipsis'] += 2;
$label = substr_replace($prefix, "ellipsis-type=class&ellipsis={$label->attr['ellipsis']}&ellipsis-tail=1&title=Stack level $j.", 2, 0).$label->value.'()';
} else {
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$label->value.'()';
}
} else {
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
}
$a[substr_replace($label, \sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;
$lastCall = $call;
}
if (null !== $trace->sliceLength) {
$a = \array_slice($a, 0, $trace->sliceLength, true);
}
return $a;
}
public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested): array
{
if (!$isNested) {
return $a;
}
$f = $frame->value;
$prefix = Caster::PREFIX_VIRTUAL;
if (isset($f['file'], $f['line'])) {
$cacheKey = $f;
unset($cacheKey['object'], $cacheKey['args']);
$cacheKey[] = self::$srcContext;
$cacheKey = implode('-', $cacheKey);
if (isset(self::$framesCache[$cacheKey])) {
$a[$prefix.'src'] = self::$framesCache[$cacheKey];
} else {
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
$f['file'] = substr($f['file'], 0, -\strlen($match[0]));
$f['line'] = (int) $match[1];
}
$src = $f['line'];
$srcKey = $f['file'];
$ellipsis = new LinkStub($srcKey, 0);
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
$ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0;
$ellipsis = $ellipsis->attr['ellipsis'] ?? 0;
if (is_file($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig\Template')) {
$template = null;
if (isset($f['object'])) {
$template = $f['object'];
} elseif ((new \ReflectionClass($f['class']))->isInstantiable()) {
$template = unserialize(\sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
}
if (null !== $template) {
$ellipsis = 0;
$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') || !is_file($templatePath = $template->getSourceContext()->getPath())) {
$templatePath = null;
}
if ($templateSrc) {
$src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, 'twig', $templatePath, $f);
$srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
}
}
}
}
if ($srcKey == $f['file']) {
$src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, 'php', $f['file'], $f);
$srcKey .= ':'.$f['line'];
if ($ellipsis) {
$ellipsis += 1 + \strlen($f['line']);
}
}
$srcAttr .= \sprintf('&separator= &file=%s&line=%d', rawurlencode($f['file']), $f['line']);
} else {
$srcAttr .= '&separator=:';
}
$srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : '';
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(["\0~$srcAttr\0$srcKey" => $src]);
}
}
unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
if ($frame->inTraceStub) {
unset($a[$prefix.'class'], $a[$prefix.'type'], $a[$prefix.'function']);
}
foreach ($a as $k => $v) {
if (!$v) {
unset($a[$k]);
}
}
if ($frame->keepArgs && !empty($f['args'])) {
$a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']);
}
return $a;
}
public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested): array
{
if ($isNested) {
$k = \sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString');
$a[$k] = new CutStub($a[$k]);
}
return $a;
}
private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array
{
if (isset($a[$xPrefix.'trace'])) {
$trace = $a[$xPrefix.'trace'];
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
} else {
$trace = [];
}
if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) {
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
}
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
}
if (empty($a[$xPrefix.'previous'])) {
unset($a[$xPrefix.'previous']);
}
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message']);
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', static fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $a[Caster::PREFIX_PROTECTED.'message']);
}
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
$a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
}
return $a;
}
private static function traceUnshift(array &$trace, ?string $class, string $file, int $line): void
{
if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
return;
}
array_unshift($trace, [
'function' => $class ? 'new '.$class : null,
'file' => $file,
'line' => $line,
]);
}
private static function extractSource(string $srcLines, int $line, int $srcContext, string $lang, ?string $file, array $frame): EnumStub
{
$srcLines = explode("\n", $srcLines);
$src = [];
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
$src[] = ($srcLines[$i] ?? '')."\n";
}
if ($frame['function'] ?? false) {
$stub = new CutStub(new \stdClass());
$stub->class = (isset($frame['class']) ? $frame['class'].$frame['type'] : '').$frame['function'];
$stub->type = Stub::TYPE_OBJECT;
$stub->attr['cut_hash'] = true;
$stub->attr['file'] = $frame['file'];
$stub->attr['line'] = $frame['line'];
try {
$caller = isset($frame['class']) ? new \ReflectionMethod($frame['class'], $frame['function']) : new \ReflectionFunction($frame['function']);
$stub->class .= ReflectionCaster::getSignature(ReflectionCaster::castFunctionAbstract($caller, [], $stub, true, Caster::EXCLUDE_VERBOSE));
if ($f = $caller->getFileName()) {
$stub->attr['file'] = $f;
$stub->attr['line'] = $caller->getStartLine();
}
} catch (\ReflectionException) {
// ignore fake class/function
}
$srcLines = ["\0~separator=\0" => $stub];
} else {
$stub = null;
$srcLines = [];
}
$ltrim = 0;
do {
$pad = null;
for ($i = $srcContext << 1; $i >= 0; --$i) {
if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
$pad ??= $c;
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
break;
}
}
}
++$ltrim;
} while (0 > $i && null !== $pad);
--$ltrim;
foreach ($src as $i => $c) {
if ($ltrim) {
$c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t");
}
$c = substr($c, 0, -1);
if ($i !== $srcContext) {
$c = new ConstStub('default', $c);
} else {
$c = new ConstStub($c, $stub ? 'in '.$stub->class : '');
if (null !== $file) {
$c->attr['file'] = $file;
$c->attr['line'] = $line;
}
}
$c->attr['lang'] = $lang;
$srcLines[\sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
}
return new EnumStub($srcLines);
}
}
================================================
FILE: Caster/FFICaster.php
================================================
<?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 FFI\CData;
use FFI\CType;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts FFI extension classes to array representation.
*
* @author Nesmeyanov Kirill <nesk@xakep.ru>
*/
final class FFICaster
{
/**
* In case of "char*" contains a string, the length of which depends on
* some other parameter, then during the generation of the string it is
* possible to go beyond the allowable memory area.
*
* This restriction serves to ensure that processing does not take
* up the entire allowable PHP memory limit.
*/
private const MAX_STRING_LENGTH = 255;
public static function castCTypeOrCData(CData|CType $data, array $args, Stub $stub): array
{
if ($data instanceof CType) {
$type = $data;
$data = null;
} else {
$type = \FFI::typeof($data);
}
$stub->class = \sprintf('%s<%s> size %d align %d', ($data ?? $type)::class, $type->getName(), $type->getSize(), $type->getAlignment());
return match ($type->getKind()) {
CType::TYPE_FLOAT,
CType::TYPE_DOUBLE,
\defined('\FFI\CType::TYPE_LONGDOUBLE') ? CType::TYPE_LONGDOUBLE : -1,
CType::TYPE_UINT8,
CType::TYPE_SINT8,
CType::TYPE_UINT16,
CType::TYPE_SINT16,
CType::TYPE_UINT32,
CType::TYPE_SINT32,
CType::TYPE_UINT64,
CType::TYPE_SINT64,
CType::TYPE_BOOL,
CType::TYPE_CHAR,
CType::TYPE_ENUM => null !== $data ? [Caster::PREFIX_VIRTUAL.'cdata' => $data->cdata] : [],
CType::TYPE_POINTER => self::castFFIPointer($stub, $type, $data),
CType::TYPE_STRUCT => self::castFFIStructLike($type, $data),
CType::TYPE_FUNC => self::castFFIFunction($stub, $type),
default => $args,
};
}
private static function castFFIFunction(Stub $stub, CType $type): array
{
$arguments = [];
for ($i = 0, $count = $type->getFuncParameterCount(); $i < $count; ++$i) {
$param = $type->getFuncParameterType($i);
$arguments[] = $param->getName();
}
$abi = match ($type->getFuncABI()) {
CType::ABI_DEFAULT,
CType::ABI_CDECL => '[cdecl]',
CType::ABI_FASTCALL => '[fastcall]',
CType::ABI_THISCALL => '[thiscall]',
CType::ABI_STDCALL => '[stdcall]',
CType::ABI_PASCAL => '[pascal]',
CType::ABI_REGISTER => '[register]',
CType::ABI_MS => '[ms]',
CType::ABI_SYSV => '[sysv]',
CType::ABI_VECTORCALL => '[vectorcall]',
default => '[unknown abi]',
};
$returnType = $type->getFuncReturnType();
$stub->class = $abi.' callable('.implode(', ', $arguments).'): '
.$returnType->getName();
return [Caster::PREFIX_VIRTUAL.'returnType' => $returnType];
}
private static function castFFIPointer(Stub $stub, CType $type, ?CData $data = null): array
{
$ptr = $type->getPointerType();
if (null === $data) {
return [Caster::PREFIX_VIRTUAL.'0' => $ptr];
}
return match ($ptr->getKind()) {
CType::TYPE_CHAR => [Caster::PREFIX_VIRTUAL.'cdata' => self::castFFIStringValue($data)],
CType::TYPE_FUNC => self::castFFIFunction($stub, $ptr),
default => [Caster::PREFIX_VIRTUAL.'cdata' => $data[0]],
};
}
private static function castFFIStringValue(CData $data): string|CutStub
{
$result = [];
$ffi = \FFI::cdef(<<<C
size_t zend_get_page_size(void);
C);
$pageSize = $ffi->zend_get_page_size();
// get cdata address
$start = $ffi->cast('uintptr_t', $ffi->cast('char*', $data))->cdata;
// accessing memory in the same page as $start is safe
$max = min(self::MAX_STRING_LENGTH, ($start | ($pageSize - 1)) - $start);
for ($i = 0; $i < $max; ++$i) {
$result[$i] = $data[$i];
if ("\0" === $data[$i]) {
return implode('', $result);
}
}
$string = implode('', $result);
$stub = new CutStub($string);
$stub->cut = -1;
$stub->value = $string;
return $stub;
}
private static function castFFIStructLike(CType $type, ?CData $data = null): array
{
$isUnion = ($type->getAttributes() & CType::ATTR_UNION) === CType::ATTR_UNION;
$result = [];
foreach ($type->getStructFieldNames() as $name) {
$field = $type->getStructFieldType($name);
// Retrieving the value of a field from a union containing
// a pointer is not a safe operation, because may contain
// incorrect data.
$isUnsafe = $isUnion && CType::TYPE_POINTER === $field->getKind();
if ($isUnsafe) {
$result[Caster::PREFIX_VIRTUAL.$name.'?'] = $field;
} elseif (null === $data) {
$result[Caster::PREFIX_VIRTUAL.$name] = $field;
} else {
$fieldName = $data->{$name} instanceof CData ? '' : $field->getName().' ';
$result[Caster::PREFIX_VIRTUAL.$fieldName.$name] = $data->{$name};
}
}
return $result;
}
}
================================================
FILE: Caster/FiberCaster.php
================================================
<?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): array
{
$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;
}
}
================================================
FILE: Caster/FrameStub.php
================================================
<?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;
/**
* Represents a single backtrace frame as returned by debug_backtrace() or Exception->getTrace().
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class FrameStub extends EnumStub
{
public function __construct(
array $frame,
public bool $keepArgs = true,
public bool $inTraceStub = false,
) {
parent::__construct($frame);
}
}
================================================
FILE: Caster/GdCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class GdCaster
{
public static function castGd(\GdImage $gd, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'size'] = imagesx($gd).'x'.imagesy($gd);
$a[Caster::PREFIX_VIRTUAL.'trueColor'] = imageistruecolor($gd);
return $a;
}
}
================================================
FILE: Caster/GmpCaster.php
================================================
<?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 GMP objects to array representation.
*
* @author Hamza Amrouche <hamza.simperfit@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class GmpCaster
{
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));
return $a;
}
}
================================================
FILE: Caster/ImagineCaster.php
================================================
<?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 Imagine\Image\ImageInterface;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @internal
*/
final class ImagineCaster
{
public static function castImage(ImageInterface $c, array $a, Stub $stub, bool $isNested): array
{
$imgData = $c->get('png');
if (\strlen($imgData) > 1 * 1000 * 1000) {
$a += [
Caster::PREFIX_VIRTUAL.'image' => new ConstStub($c->getSize()),
];
} else {
$a += [
Caster::PREFIX_VIRTUAL.'image' => new ImgStub($imgData, 'image/png', $c->getSize()),
];
}
return $a;
}
}
================================================
FILE: Caster/ImgStub.php
================================================
<?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;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class ImgStub extends ConstStub
{
public function __construct(string $data, string $contentType, string $size = '')
{
$this->value = '';
$this->attr['img-data'] = $data;
$this->attr['img-size'] = $size;
$this->attr['content-type'] = $contentType;
}
}
================================================
FILE: Caster/IntlCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
*
* @final
*
* @internal
*/
class IntlCaster
{
public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
];
return self::castError($c, $a);
}
public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
];
if ($filter & Caster::EXCLUDE_VERBOSE) {
$stub->cut += 3;
return self::castError($c, $a);
}
$a += [
Caster::PREFIX_VIRTUAL.'attributes' => new EnumStub(
[
'PARSE_INT_ONLY' => $c->getAttribute(\NumberFormatter::PARSE_INT_ONLY),
'GROUPING_USED' => $c->getAttribute(\NumberFormatter::GROUPING_USED),
'DECIMAL_ALWAYS_SHOWN' => $c->getAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN),
'MAX_INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_INTEGER_DIGITS),
'MIN_INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_INTEGER_DIGITS),
'INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::INTEGER_DIGITS),
'MAX_FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_FRACTION_DIGITS),
'MIN_FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_FRACTION_DIGITS),
'FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::FRACTION_DIGITS),
'MULTIPLIER' => $c->getAttribute(\NumberFormatter::MULTIPLIER),
'GROUPING_SIZE' => $c->getAttribute(\NumberFormatter::GROUPING_SIZE),
'ROUNDING_MODE' => $c->getAttribute(\NumberFormatter::ROUNDING_MODE),
'ROUNDING_INCREMENT' => $c->getAttribute(\NumberFormatter::ROUNDING_INCREMENT),
'FORMAT_WIDTH' => $c->getAttribute(\NumberFormatter::FORMAT_WIDTH),
'PADDING_POSITION' => $c->getAttribute(\NumberFormatter::PADDING_POSITION),
'SECONDARY_GROUPING_SIZE' => $c->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE),
'SIGNIFICANT_DIGITS_USED' => $c->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED),
'MIN_SIGNIFICANT_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS),
'MAX_SIGNIFICANT_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS),
'LENIENT_PARSE' => $c->getAttribute(\NumberFormatter::LENIENT_PARSE),
]
),
Caster::PREFIX_VIRTUAL.'text_attributes' => new EnumStub(
[
'POSITIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX),
'POSITIVE_SUFFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_SUFFIX),
'NEGATIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX),
'NEGATIVE_SUFFIX' => $c->getTextAttribute(\NumberFormatter::NEGATIVE_SUFFIX),
'PADDING_CHARACTER' => $c->getTextAttribute(\NumberFormatter::PADDING_CHARACTER),
'CURRENCY_CODE' => $c->getTextAttribute(\NumberFormatter::CURRENCY_CODE),
'DEFAULT_RULESET' => $c->getTextAttribute(\NumberFormatter::DEFAULT_RULESET),
'PUBLIC_RULESETS' => $c->getTextAttribute(\NumberFormatter::PUBLIC_RULESETS),
]
),
Caster::PREFIX_VIRTUAL.'symbols' => new EnumStub(
[
'DECIMAL_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL),
'GROUPING_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL),
'PATTERN_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::PATTERN_SEPARATOR_SYMBOL),
'PERCENT_SYMBOL' => $c->getSymbol(\NumberFormatter::PERCENT_SYMBOL),
'ZERO_DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::ZERO_DIGIT_SYMBOL),
'DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::DIGIT_SYMBOL),
'MINUS_SIGN_SYMBOL' => $c->getSymbol(\NumberFormatter::MINUS_SIGN_SYMBOL),
'PLUS_SIGN_SYMBOL' => $c->getSymbol(\NumberFormatter::PLUS_SIGN_SYMBOL),
'CURRENCY_SYMBOL' => $c->getSymbol(\NumberFormatter::CURRENCY_SYMBOL),
'INTL_CURRENCY_SYMBOL' => $c->getSymbol(\NumberFormatter::INTL_CURRENCY_SYMBOL),
'MONETARY_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL),
'EXPONENTIAL_SYMBOL' => $c->getSymbol(\NumberFormatter::EXPONENTIAL_SYMBOL),
'PERMILL_SYMBOL' => $c->getSymbol(\NumberFormatter::PERMILL_SYMBOL),
'PAD_ESCAPE_SYMBOL' => $c->getSymbol(\NumberFormatter::PAD_ESCAPE_SYMBOL),
'INFINITY_SYMBOL' => $c->getSymbol(\NumberFormatter::INFINITY_SYMBOL),
'NAN_SYMBOL' => $c->getSymbol(\NumberFormatter::NAN_SYMBOL),
'SIGNIFICANT_DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL),
'MONETARY_GROUPING_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL),
]
),
];
return self::castError($c, $a);
}
public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'display_name' => $c->getDisplayName(),
Caster::PREFIX_VIRTUAL.'id' => $c->getID(),
Caster::PREFIX_VIRTUAL.'raw_offset' => $c->getRawOffset(),
];
if ($c->useDaylightTime()) {
$a += [
Caster::PREFIX_VIRTUAL.'dst_savings' => $c->getDSTSavings(),
];
}
return self::castError($c, $a);
}
public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$a += [
Caster::PREFIX_VIRTUAL.'type' => $c->getType(),
Caster::PREFIX_VIRTUAL.'first_day_of_week' => $c->getFirstDayOfWeek(),
Caster::PREFIX_VIRTUAL.'minimal_days_in_first_week' => $c->getMinimalDaysInFirstWeek(),
Caster::PREFIX_VIRTUAL.'repeated_wall_time_option' => $c->getRepeatedWallTimeOption(),
Caster::PREFIX_VIRTUAL.'skipped_wall_time_option' => $c->getSkippedWallTimeOption(),
Caster::PREFIX_VIRTUAL.'time' => $c->getTime(),
Caster::PREFIX_VIRTUAL.'in_daylight_time' => $c->inDaylightTime(),
Caster::PREFIX_VIRTUAL.'is_lenient' => $c->isLenient(),
Caster::PREFIX_VIRTUAL.'time_zone' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getTimeZone()) : $c->getTimeZone(),
];
return self::castError($c, $a);
}
public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
Caster::PREFIX_VIRTUAL.'calendar' => $c->getCalendar(),
Caster::PREFIX_VIRTUAL.'time_zone_id' => $c->getTimeZoneId(),
Caster::PREFIX_VIRTUAL.'time_type' => $c->getTimeType(),
Caster::PREFIX_VIRTUAL.'date_type' => $c->getDateType(),
Caster::PREFIX_VIRTUAL.'calendar_object' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getCalendarObject()) : $c->getCalendarObject(),
Caster::PREFIX_VIRTUAL.'time_zone' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getTimeZone()) : $c->getTimeZone(),
];
return self::castError($c, $a);
}
private static function castError(object $c, array $a): array
{
if ($errorCode = $c->getErrorCode()) {
$a += [
Caster::PREFIX_VIRTUAL.'error_code' => $errorCode,
Caster::PREFIX_VIRTUAL.'error_message' => $c->getErrorMessage(),
];
}
return $a;
}
}
================================================
FILE: Caster/LinkStub.php
================================================
<?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;
/**
* Represents a file or a URL.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class LinkStub extends ConstStub
{
public bool $inVendor = false;
private static array $vendorRoots;
private static array $composerRoots = [];
public function __construct(string $label, int $line = 0, ?string $href = null)
{
$this->value = $label;
if (!\is_string($href ??= $label)) {
return;
}
if (str_starts_with($href, 'file://')) {
if ($href === $label) {
$label = substr($label, 7);
}
$href = substr($href, 7);
} elseif (str_contains($href, '://')) {
$this->attr['href'] = $href;
return;
}
if (!is_file($href)) {
return;
}
if ($line) {
$this->attr['line'] = $line;
}
if ($label !== $this->attr['file'] = realpath($href) ?: $href) {
return;
}
if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
$this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
} elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
$this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2)));
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1;
}
}
private function getComposerRoot(string $file, bool &$inVendor): string|false
{
if (!isset(self::$vendorRoots)) {
self::$vendorRoots = [];
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname($r->getFileName(), 2);
if (is_file($v.'/composer/installed.json')) {
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
}
}
}
}
$inVendor = false;
if (isset(self::$composerRoots[$dir = \dirname($file)])) {
return self::$composerRoots[$dir];
}
foreach (self::$vendorRoots as $root) {
if ($inVendor = str_starts_with($file, $root)) {
return $root;
}
}
$parent = $dir;
while (!@is_file($parent.'/composer.json')) {
if (!@file_exists($parent)) {
// open_basedir restriction in effect
break;
}
if ($parent === \dirname($parent)) {
return self::$composerRoots[$dir] = false;
}
$parent = \dirname($parent);
}
return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
}
}
================================================
FILE: Caster/MemcachedCaster.php
================================================
<?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;
/**
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
*
* @final
*
* @internal
*/
class MemcachedCaster
{
private static array $optionConstants;
private static array $defaultOptions;
public static function castMemcached(\Memcached $c, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(),
Caster::PREFIX_VIRTUAL.'options' => new EnumStub(
self::getNonDefaultOptions($c)
),
];
return $a;
}
private static function getNonDefaultOptions(\Memcached $c): array
{
self::$defaultOptions ??= self::discoverDefaultOptions();
self::$optionConstants ??= self::getOptionConstants();
$nonDefaultOptions = [];
foreach (self::$optionConstants as $constantKey => $value) {
if (self::$defaultOptions[$constantKey] !== $option = $c->getOption($value)) {
$nonDefaultOptions[$constantKey] = $option;
}
}
return $nonDefaultOptions;
}
private static function discoverDefaultOptions(): array
{
$defaultMemcached = new \Memcached();
$defaultMemcached->addServer('127.0.0.1', 11211);
$defaultOptions = [];
self::$optionConstants ??= self::getOptionConstants();
foreach (self::$optionConstants as $constantKey => $value) {
$defaultOptions[$constantKey] = $defaultMemcached->getOption($value);
}
return $defaultOptions;
}
private static function getOptionConstants(): array
{
$reflectedMemcached = new \ReflectionClass(\Memcached::class);
$optionConstants = [];
foreach ($reflectedMemcached->getConstants() as $constantKey => $value) {
if (str_starts_with($constantKey, 'OPT_')) {
$optionConstants[$constantKey] = $value;
}
}
return $optionConstants;
}
}
================================================
FILE: Caster/MysqliCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class MysqliCaster
{
public static function castMysqliDriver(\mysqli_driver $c, array $a, Stub $stub, bool $isNested): array
{
foreach ($a as $k => $v) {
if (isset($c->$k)) {
$a[$k] = $c->$k;
}
}
return $a;
}
}
================================================
FILE: Caster/OpenSSLCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
* @author Alexandre Daubois <alex.daubois@gmail.com>
*
* @internal
*/
final class OpenSSLCaster
{
public static function castOpensslX509(\OpenSSLCertificate $h, array $a, Stub $stub, bool $isNested): array
{
$stub->cut = -1;
$info = openssl_x509_parse($h, false);
$pin = openssl_pkey_get_public($h);
$pin = openssl_pkey_get_details($pin)['key'];
$pin = \array_slice(explode("\n", $pin), 1, -2);
$pin = base64_decode(implode('', $pin));
$pin = base64_encode(hash('sha256', $pin, true));
$a += [
Caster::PREFIX_VIRTUAL.'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])),
Caster::PREFIX_VIRTUAL.'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])),
Caster::PREFIX_VIRTUAL.'expiry' => new ConstStub(date(\DateTimeInterface::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']),
Caster::PREFIX_VIRTUAL.'fingerprint' => new EnumStub([
'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)),
'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)),
'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)),
'pin-sha256' => new ConstStub($pin),
]),
];
return $a;
}
public static function castOpensslAsymmetricKey(\OpenSSLAsymmetricKey $key, array $a, Stub $stub, bool $isNested): array
{
foreach (openssl_pkey_get_details($key) as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
unset($a[Caster::PREFIX_VIRTUAL.'rsa']); // binary data
return $a;
}
public static function castOpensslCsr(\OpenSSLCertificateSigningRequest $csr, array $a, Stub $stub, bool $isNested): array
{
foreach (openssl_csr_get_subject($csr, false) as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
return $a;
}
}
================================================
FILE: Caster/PdoCaster.php
================================================
<?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 PDO related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class PdoCaster
{
private const PDO_ATTRIBUTES = [
'CASE' => [
\PDO::CASE_LOWER => 'LOWER',
\PDO::CASE_NATURAL => 'NATURAL',
\PDO::CASE_UPPER => 'UPPER',
],
'ERRMODE' => [
\PDO::ERRMODE_SILENT => 'SILENT',
\PDO::ERRMODE_WARNING => 'WARNING',
\PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
],
'TIMEOUT',
'PREFETCH',
'AUTOCOMMIT',
'PERSISTENT',
'DRIVER_NAME',
'SERVER_INFO',
'ORACLE_NULLS' => [
\PDO::NULL_NATURAL => 'NATURAL',
\PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
\PDO::NULL_TO_STRING => 'TO_STRING',
],
'CLIENT_VERSION',
'SERVER_VERSION',
'STATEMENT_CLASS',
'EMULATE_PREPARES',
'CONNECTION_STATUS',
'STRINGIFY_FETCHES',
'DEFAULT_FETCH_MODE' => [
\PDO::FETCH_ASSOC => 'ASSOC',
\PDO::FETCH_BOTH => 'BOTH',
\PDO::FETCH_LAZY => 'LAZY',
\PDO::FETCH_NUM => 'NUM',
\PDO::FETCH_OBJ => 'OBJ',
],
];
public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested): array
{
$attr = [];
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
foreach (self::PDO_ATTRIBUTES as $k => $v) {
if (!isset($k[0])) {
$k = $v;
$v = [];
}
try {
$attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
if ($v && isset($v[$attr[$k]])) {
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
}
} catch (\Exception) {
}
}
if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
if ($attr[$k][1]) {
$attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
}
$attr[$k][0] = new ClassStub($attr[$k][0]);
}
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'inTransaction' => method_exists($c, 'inTransaction'),
$prefix.'errorInfo' => $c->errorInfo(),
$prefix.'attributes' => new EnumStub($attr),
];
if ($a[$prefix.'inTransaction']) {
$a[$prefix.'inTransaction'] = $c->inTransaction();
} else {
unset($a[$prefix.'inTransaction']);
}
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
unset($a[$prefix.'errorInfo']);
}
$c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
return $a;
}
public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a[$prefix.'errorInfo'] = $c->errorInfo();
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
unset($a[$prefix.'errorInfo']);
}
return $a;
}
}
================================================
FILE: Caster/PgSqlCaster.php
================================================
<?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 pgsql resources to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class PgSqlCaster
{
private const PARAM_CODES = [
'server_encoding',
'client_encoding',
'is_superuser',
'session_authorization',
'DateStyle',
'TimeZone',
'IntervalStyle',
'integer_datetimes',
'application_name',
'standard_conforming_strings',
];
private const TRANSACTION_STATUS = [
\PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
\PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
\PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
\PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
\PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
];
private const RESULT_STATUS = [
\PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
\PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
\PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
\PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
\PGSQL_COPY_IN => 'PGSQL_COPY_IN',
\PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
\PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
\PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
];
private const DIAG_CODES = [
'severity' => \PGSQL_DIAG_SEVERITY,
'sqlstate' => \PGSQL_DIAG_SQLSTATE,
'message' => \PGSQL_DIAG_MESSAGE_PRIMARY,
'detail' => \PGSQL_DIAG_MESSAGE_DETAIL,
'hint' => \PGSQL_DIAG_MESSAGE_HINT,
'statement position' => \PGSQL_DIAG_STATEMENT_POSITION,
'internal position' => \PGSQL_DIAG_INTERNAL_POSITION,
'internal query' => \PGSQL_DIAG_INTERNAL_QUERY,
'context' => \PGSQL_DIAG_CONTEXT,
'file' => \PGSQL_DIAG_SOURCE_FILE,
'line' => \PGSQL_DIAG_SOURCE_LINE,
'function' => \PGSQL_DIAG_SOURCE_FUNCTION,
];
public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested): array
{
$a['seek position'] = pg_lo_tell($lo);
return $a;
}
public static function castLink($link, array $a, Stub $stub, bool $isNested): array
{
$a['status'] = pg_connection_status($link);
$a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
$a['busy'] = pg_connection_busy($link);
$a['transaction'] = pg_transaction_status($link);
if (isset(self::TRANSACTION_STATUS[$a['transaction']])) {
$a['transaction'] = new ConstStub(self::TRANSACTION_STATUS[$a['transaction']], $a['transaction']);
}
$a['pid'] = pg_get_pid($link);
$a['last error'] = pg_last_error($link);
$a['last notice'] = pg_last_notice($link);
$a['host'] = pg_host($link);
$a['port'] = pg_port($link);
$a['dbname'] = pg_dbname($link);
$a['options'] = pg_options($link);
$a['version'] = pg_version($link);
foreach (self::PARAM_CODES as $v) {
if (false !== $s = pg_parameter_status($link, $v)) {
$a['param'][$v] = $s;
}
}
$a['param']['client_encoding'] = pg_client_encoding($link);
$a['param'] = new EnumStub($a['param']);
return $a;
}
public static function castResult($result, array $a, Stub $stub, bool $isNested): array
{
$a['num rows'] = pg_num_rows($result);
$a['status'] = pg_result_status($result);
if (isset(self::RESULT_STATUS[$a['status']])) {
$a['status'] = new ConstStub(self::RESULT_STATUS[$a['status']], $a['status']);
}
$a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING);
if (-1 === $a['num rows']) {
foreach (self::DIAG_CODES as $k => $v) {
$a['error'][$k] = pg_result_error_field($result, $v);
}
}
$a['affected rows'] = pg_affected_rows($result);
$a['last OID'] = pg_last_oid($result);
$fields = pg_num_fields($result);
for ($i = 0; $i < $fields; ++$i) {
$field = [
'name' => pg_field_name($result, $i),
'table' => \sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
'type' => \sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
'nullable' => (bool) pg_field_is_null($result, null, $i),
'storage' => pg_field_size($result, $i).' bytes',
'display' => pg_field_prtlen($result, null, $i).' chars',
];
if (' (OID: )' === $field['table']) {
$field['table'] = null;
}
if ('-1 bytes' === $field['storage']) {
$field['storage'] = 'variable size';
} elseif ('1 bytes' === $field['storage']) {
$field['storage'] = '1 byte';
}
if ('1 chars' === $field['display']) {
$field['display'] = '1 char';
}
$a['fields'][] = new EnumStub($field);
}
return $a;
}
}
================================================
FILE: Caster/ProxyManagerCaster.php
================================================
<?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 ProxyManager\Proxy\ProxyInterface;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class ProxyManagerCaster
{
public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested): array
{
if ($parent = get_parent_class($c)) {
$stub->class .= ' - '.$parent;
}
$stub->class .= '@proxy';
return $a;
}
}
================================================
FILE: Caster/RdKafkaCaster.php
================================================
<?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>
*
* @internal
*/
class RdKafkaCaster
{
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
try {
$assignment = $c->getAssignment();
} catch (RdKafkaException) {
$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): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'name' => $c->getName(),
];
return $a;
}
public static function castTopicPartition(TopicPartition $c, array $a): array
{
$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): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'errstr' => $c->errstr(),
];
return $a;
}
public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested): array
{
$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): array
{
$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): array
{
$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): array
{
$a += iterator_to_array($c);
return $a;
}
public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested): array
{
$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): array
{
$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): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'id' => $c->getId(),
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
];
return $a;
}
private static function extractMetadata(KafkaConsumer|\RdKafka $c): array
{
$prefix = Caster::PREFIX_VIRTUAL;
try {
$m = $c->getMetadata(true, null, 500);
} catch (RdKafkaException) {
return [];
}
return [
$prefix.'orig_broker_id' => $m->getOrigBrokerId(),
$prefix.'orig_broker_name' => $m->getOrigBrokerName(),
$prefix.'brokers' => $m->getBrokers(),
$prefix.'topics' => $m->getTopics(),
];
}
}
================================================
FILE: Caster/RedisCaster.php
================================================
<?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 Relay\Relay;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts Redis class from ext-redis to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class RedisCaster
{
private const SERIALIZERS = [
0 => 'NONE', // Redis::SERIALIZER_NONE
1 => 'PHP', // Redis::SERIALIZER_PHP
2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
];
private const MODES = [
0 => 'ATOMIC', // Redis::ATOMIC
1 => 'MULTI', // Redis::MULTI
2 => 'PIPELINE', // Redis::PIPELINE
];
private const COMPRESSION_MODES = [
0 => 'NONE', // Redis::COMPRESSION_NONE
1 => 'LZF', // Redis::COMPRESSION_LZF
];
private const FAILOVER_OPTIONS = [
\RedisCluster::FAILOVER_NONE => 'NONE',
\RedisCluster::FAILOVER_ERROR => 'ERROR',
\RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
\RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
];
public static function castRedis(\Redis|Relay $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
if (!$connected = $c->isConnected()) {
return $a + [
$prefix.'isConnected' => $connected,
];
}
$mode = $c->getMode();
return $a + [
$prefix.'isConnected' => $connected,
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
$prefix.'auth' => $c->getAuth(),
$prefix.'mode' => isset(self::MODES[$mode]) ? new ConstStub(self::MODES[$mode], $mode) : $mode,
$prefix.'dbNum' => $c->getDbNum(),
$prefix.'timeout' => $c->getTimeout(),
$prefix.'lastError' => $c->getLastError(),
$prefix.'persistentId' => $c->getPersistentID(),
$prefix.'options' => self::getRedisOptions($c),
];
}
public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
return $a + [
$prefix.'hosts' => $c->_hosts(),
$prefix.'function' => ClassStub::wrapCallable($c->_function()),
$prefix.'lastError' => $c->getLastError(),
$prefix.'options' => self::getRedisOptions($c),
];
}
public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
$a += [
$prefix.'_masters' => $c->_masters(),
$prefix.'_redir' => $c->_redir(),
$prefix.'mode' => new ConstStub($c->getMode() ? 'MULTI' : 'ATOMIC', $c->getMode()),
$prefix.'lastError' => $c->getLastError(),
$prefix.'options' => self::getRedisOptions($c, [
'SLAVE_FAILOVER' => isset(self::FAILOVER_OPTIONS[$failover]) ? new ConstStub(self::FAILOVER_OPTIONS[$failover], $failover) : $failover,
]),
];
return $a;
}
private static function getRedisOptions(\Redis|Relay|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub
{
$serializer = $redis->getOption(\defined('Redis::OPT_SERIALIZER') ? \Redis::OPT_SERIALIZER : 1);
if (\is_array($serializer)) {
foreach ($serializer as &$v) {
if (isset(self::SERIALIZERS[$v])) {
$v = new ConstStub(self::SERIALIZERS[$v], $v);
}
}
} elseif (isset(self::SERIALIZERS[$serializer])) {
$serializer = new ConstStub(self::SERIALIZERS[$serializer], $serializer);
}
$compression = \defined('Redis::OPT_COMPRESSION') ? $redis->getOption(\Redis::OPT_COMPRESSION) : 0;
if (\is_array($compression)) {
foreach ($compression as &$v) {
if (isset(self::COMPRESSION_MODES[$v])) {
$v = new ConstStub(self::COMPRESSION_MODES[$v], $v);
}
}
} elseif (isset(self::COMPRESSION_MODES[$compression])) {
$compression = new ConstStub(self::COMPRESSION_MODES[$compression], $compression);
}
$retry = \defined('Redis::OPT_SCAN') ? $redis->getOption(\Redis::OPT_SCAN) : 0;
if (\is_array($retry)) {
foreach ($retry as &$v) {
$v = new ConstStub($v ? 'RETRY' : 'NORETRY', $v);
}
} else {
$retry = new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry);
}
$options += [
'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : Relay::OPT_TCP_KEEPALIVE,
'READ_TIMEOUT' => $redis->getOption(\defined('Redis::OPT_READ_TIMEOUT') ? \Redis::OPT_READ_TIMEOUT : Relay::OPT_READ_TIMEOUT),
'COMPRESSION' => $compression,
'SERIALIZER' => $serializer,
'PREFIX' => $redis->getOption(\defined('Redis::OPT_PREFIX') ? \Redis::OPT_PREFIX : Relay::OPT_PREFIX),
'SCAN' => $retry,
];
return new EnumStub($options);
}
}
================================================
FILE: Caster/ReflectionCaster.php
================================================
<?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 Reflector related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class ReflectionCaster
{
public const UNSET_CLOSURE_FILE_INFO = ['Closure' => __CLASS__.'::unsetClosureFileInfo'];
private const EXTRA_MAP = [
'docComment' => 'getDocComment',
'extension' => 'getExtensionName',
'isDisabled' => 'isDisabled',
'isDeprecated' => 'isDeprecated',
'isInternal' => 'isInternal',
'isUserDefined' => 'isUserDefined',
'isGenerator' => 'isGenerator',
'isVariadic' => 'isVariadic',
];
public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$c = new \ReflectionFunction($c);
$a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);
if (!$c->isAnonymous()) {
$stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name;
unset($a[$prefix.'class']);
}
unset($a[$prefix.'extra']);
$stub->class .= self::getSignature($a);
if ($f = $c->getFileName()) {
$stub->attr['file'] = $f;
$stub->attr['line'] = $c->getStartLine();
}
unset($a[$prefix.'parameters']);
if ($filter & Caster::EXCLUDE_VERBOSE) {
$stub->cut += ($c->getFileName() ? 2 : 0) + \count($a);
return [];
}
if ($f) {
$a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
}
return $a;
}
public static function unsetClosureFileInfo(\Closure $c, array $a): array
{
unset($a[Caster::PREFIX_VIRTUAL.'file'], $a[Caster::PREFIX_VIRTUAL.'line']);
return $a;
}
public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested): array
{
// Cannot create ReflectionGenerator based on a terminated Generator
try {
$reflectionGenerator = new \ReflectionGenerator($c);
return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
} catch (\Exception) {
$a[Caster::PREFIX_VIRTUAL.'closed'] = true;
return $a;
}
}
public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
if ($c instanceof \ReflectionNamedType) {
$a += [
$prefix.'name' => $c->getName(),
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
];
} elseif ($c instanceof \ReflectionUnionType || $c instanceof \ReflectionIntersectionType) {
$a[$prefix.'allowsNull'] = $c->allowsNull();
self::addMap($a, $c, [
'types' => 'getTypes',
]);
} else {
$a[$prefix.'allowsNull'] = $c->allowsNull();
}
return $a;
}
public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested): array
{
$map = [
'arguments' => 'getArguments',
];
self::addMap($a, $c, $map);
return $a;
}
public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
if ($c->getThis()) {
$a[$prefix.'this'] = new CutStub($c->getThis());
}
$function = $c->getFunction();
$frame = [
'class' => $function->class ?? null,
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
'function' => $function->name,
'file' => $c->getExecutingFile(),
'line' => $c->getExecutingLine(),
];
if ($trace = $c->getTrace(\DEBUG_BACKTRACE_IGNORE_ARGS)) {
$function = new \ReflectionGenerator($c->getExecutingGenerator());
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine(),
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
} else {
$function = new FrameStub($frame, false, true);
$function = ExceptionCaster::castFrameStub($function, [], $function, true);
$a[$prefix.'executing'] = $function[$prefix.'src'];
}
$a[Caster::PREFIX_VIRTUAL.'closed'] = false;
return $a;
}
public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$prefix = Caster::PREFIX_VIRTUAL;
if ($n = \Reflection::getModifierNames($c->getModifiers())) {
$a[$prefix.'modifiers'] = implode(' ', $n);
}
self::addMap($a, $c, [
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getReflectionConstants',
]);
foreach ($c->getProperties() as $n) {
$a[$prefix.'properties'][$n->name] = $n;
}
foreach ($c->getMethods() as $n) {
$a[$prefix.'methods'][$n->name] = $n;
}
self::addAttributes($a, $c, $prefix);
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}
return $a;
}
public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array
{
$prefix = Caster::PREFIX_VIRTUAL;
self::addMap($a, $c, [
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureCalledClass',
'this' => 'getClosureThis',
]);
if (isset($a[$prefix.'returnType'])) {
$v = $a[$prefix.'returnType'];
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType'] instanceof \ReflectionNamedType && $a[$prefix.'returnType']->allowsNull() && !\in_array($v, ['mixed', 'null'], true) ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
}
if (isset($a[$prefix.'class'])) {
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
}
if (isset($a[$prefix.'this'])) {
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
}
foreach ($c->getParameters() as $v) {
$k = '$'.$v->name;
if ($v->isVariadic()) {
$k = '...'.$k;
}
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
$a[$prefix.'parameters'][$k] = $v;
}
if (isset($a[$prefix.'parameters'])) {
$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)) {
$a[$prefix.'use']['$'.$k] = new CutStub($v);
} else {
$a[$prefix.'use']['$'.$k] = &$v;
}
}
unset($v);
$a[$prefix.'use'] = new EnumStub($a[$prefix.'use']);
}
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}
return $a;
}
public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested): array
{
$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): array
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
return $a;
}
public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
self::addMap($a, $c, [
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
'byReference' => 'isPassedByReference',
'allowsNull' => 'allowsNull',
]);
self::addAttributes($a, $c, $prefix);
if ($v = $c->getType()) {
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
}
if (isset($a[$prefix.'typeHint'])) {
$v = $a[$prefix.'typeHint'];
$a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
} else {
unset($a[$prefix.'allowsNull']);
}
if ($c->isOptional()) {
try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if ($c->isDefaultValueConstant() && !\is_object($v)) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException) {
}
}
return $a;
}
public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested): array
{
$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, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
return $a;
}
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested): array
{
self::addMap($a, $c, [
'version' => 'getVersion',
'dependencies' => 'getDependencies',
'iniEntries' => 'getIniEntries',
'isPersistent' => 'isPersistent',
'isTemporary' => 'isTemporary',
'constants' => 'getConstants',
'functions' => 'getFunctions',
'classes' => 'getClasses',
]);
return $a;
}
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested): array
{
self::addMap($a, $c, [
'version' => 'getVersion',
'author' => 'getAuthor',
'copyright' => 'getCopyright',
'url' => 'getURL',
]);
return $a;
}
public static function getSignature(array $a): string
{
$prefix = Caster::PREFIX_VIRTUAL;
$signature = '';
if (isset($a[$prefix.'parameters'])) {
foreach ($a[$prefix.'parameters']->value as $k => $param) {
$signature .= ', ';
if ($type = $param->getType()) {
if (!$type instanceof \ReflectionNamedType) {
$signature .= $type.' ';
} else {
if ($param->allowsNull() && !\in_array($type->getName(), ['mixed', 'null'], true)) {
$signature .= '?';
}
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
}
}
$signature .= $k;
if (!$param->isDefaultValueAvailable()) {
continue;
}
$v = $param->getDefaultValue();
$signature .= ' = ';
if ($param->isDefaultValueConstant()) {
$signature .= substr(strrchr('\\'.$param->getDefaultValueConstantName(), '\\'), 1);
} elseif (null === $v) {
$signature .= 'null';
} elseif (\is_array($v)) {
$signature .= $v ? '[…'.\count($v).']' : '[]';
} elseif (\is_string($v)) {
$signature .= 10 > \strlen($v) && !str_contains($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'";
} elseif (\is_bool($v)) {
$signature .= $v ? 'true' : 'false';
} elseif (\is_object($v)) {
$signature .= 'new '.substr(strrchr('\\'.get_debug_type($v), '\\'), 1);
} else {
$signature .= $v;
}
}
}
$signature = (empty($a[$prefix.'returnsReference']) ? '' : '&').'('.substr($signature, 2).')';
if (isset($a[$prefix.'returnType'])) {
$signature .= ': '.substr(strrchr('\\'.$a[$prefix.'returnType'], '\\'), 1);
}
return $signature;
}
private static function addExtra(array &$a, \Reflector $c): void
{
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : [];
if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
$x['file'] = new LinkStub($m, $c->getStartLine());
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
}
self::addMap($x, $c, self::EXTRA_MAP, '');
if ($x) {
$a[Caster::PREFIX_VIRTUAL.'extra'] = new EnumStub($x);
}
}
private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL): void
{
foreach ($map as $k => $m) {
if ('isDisabled' === $k) {
continue;
}
if (method_exists($c, $m) && false !== ($m = $c->$m()) && null !== $m) {
$a[$prefix.$k] = $m instanceof \Reflector ? $m->name : $m;
}
}
}
private static function addAttributes(array &$a, \Reflector $c, string $prefix = Caster::PREFIX_VIRTUAL): void
{
foreach ($c->getAttributes() as $n) {
$a[$prefix.'attributes'][] = $n;
}
}
}
================================================
FILE: Caster/ResourceCaster.php
================================================
<?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 common resource types to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class ResourceCaster
{
public static function castDba(\Dba\Connection $dba, array $a, Stub $stub, bool $isNested): array
{
if (\PHP_VERSION_ID < 80402) {
// @see https://github.com/php/php-src/issues/16990
return $a;
}
$list = dba_list();
$a['file'] = $list[(int) $dba];
return $a;
}
public static function castProcess($process, array $a, Stub $stub, bool $isNested): array
{
return proc_get_status($process);
}
public static function castStream($stream, array $a, Stub $stub, bool $isNested): array
{
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
if ($a['uri'] ?? false) {
$a['uri'] = new LinkStub($a['uri']);
}
return $a;
}
public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested): array
{
return @stream_context_get_params($stream) ?: $a;
}
}
================================================
FILE: Caster/ScalarStub.php
================================================
<?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;
/**
* Represents any arbitrary value.
*
* @author Alexandre Daubois <alex.daubois@gmail.com>
*/
class ScalarStub extends Stub
{
public function __construct(mixed $value)
{
$this->value = $value;
}
}
================================================
FILE: Caster/SocketCaster.php
================================================
<?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;
/**
* @author Nicolas Grekas <p@tchwork.com>
* @author Alexandre Daubois <alex.daubois@gmail.com>
*
* @internal
*/
final class SocketCaster
{
public static function castSocket(\Socket $socket, array $a, Stub $stub, bool $isNested): array
{
socket_getsockname($socket, $addr, $port);
$info = stream_get_meta_data(socket_export_stream($socket));
$uri = ($info['uri'] ?? '//');
if (str_starts_with($uri, 'unix://')) {
$uri .= $addr;
} else {
$uri .= \sprintf(str_contains($addr, ':') ? '[%s]:%s' : '%s:%s', $addr, $port);
}
$a[Caster::PREFIX_VIRTUAL.'uri'] = $uri;
if (@socket_atmark($socket)) {
$a[Caster::PREFIX_VIRTUAL.'atmark'] = true;
}
$a += [
Caster::PREFIX_VIRTUAL.'timed_out' => $info['timed_out'],
Caster::PREFIX_VIRTUAL.'blocked' => $info['blocked'],
];
if (!$lastError = socket_last_error($socket)) {
return $a;
}
static $errors;
if (!$errors) {
$errors = get_defined_constants(true)['sockets'] ?? [];
$errors = array_flip(array_filter($errors, static fn ($k) => str_starts_with($k, 'SOCKET_E'), \ARRAY_FILTER_USE_KEY));
}
$a[Caster::PREFIX_VIRTUAL.'last_error'] = new ConstStub($errors[$lastError], socket_strerror($lastError));
return $a;
}
}
================================================
FILE: Caster/SplCaster.php
================================================
<?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 SPL related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class SplCaster
{
private const SPL_FILE_OBJECT_FLAGS = [
\SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
\SplFileObject::READ_AHEAD => 'READ_AHEAD',
\SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
\SplFileObject::READ_CSV => 'READ_CSV',
];
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested): array
{
return self::castSplArray($c, $a, $stub, $isNested);
}
public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array
{
return self::castSplArray($c, $a, $stub, $isNested);
}
public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
];
return $a;
}
public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$mode = $c->getIteratorMode();
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
$a += [
$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
$prefix.'dllist' => iterator_to_array($c),
];
$c->setIteratorMode($mode);
return $a;
}
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested): array
{
static $map = [
'path' => 'getPath',
'filename' => 'getFilename',
'basename' => 'getBasename',
'pathname' => 'getPathname',
'extension' => 'getExtension',
'realPath' => 'getRealPath',
'aTime' => 'getATime',
'mTime' => 'getMTime',
'cTime' => 'getCTime',
'inode' => 'getInode',
'size' => 'getSize',
'perms' => 'getPerms',
'owner' => 'getOwner',
'group' => 'getGroup',
'type' => 'getType',
'writable' => 'isWritable',
'readable' => 'isReadable',
'executable' => 'isExecutable',
'file' => 'isFile',
'dir' => 'isDir',
'link' => 'isLink',
'linkTarget' => 'getLinkTarget',
];
$prefix = Caster::PREFIX_VIRTUAL;
unset($a["\0SplFileInfo\0fileName"]);
unset($a["\0SplFileInfo\0pathName"]);
try {
$c->isReadable();
} catch (\RuntimeException $e) {
if ('Object not initialized' !== $e->getMessage()) {
throw $e;
}
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
} catch (\Error $e) {
if ('Object not initialized' !== $e->getMessage()) {
throw $e;
}
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
return $a;
}
foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception) {
}
}
if ($a[$prefix.'realPath'] ?? false) {
$a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
}
if (isset($a[$prefix.'perms'])) {
$a[$prefix.'perms'] = new ConstStub(\sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
}
static $mapDate = ['aTime', 'mTime', 'cTime'];
foreach ($mapDate as $key) {
if (isset($a[$prefix.$key])) {
$a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]);
}
}
return $a;
}
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested): array
{
static $map = [
'csvControl' => 'getCsvControl',
'flags' => 'getFlags',
'maxLineLen' => 'getMaxLineLen',
'fstat' => 'fstat',
'eof' => 'eof',
'key' => 'key',
];
$prefix = Caster::PREFIX_VIRTUAL;
foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception) {
}
}
if (isset($a[$prefix.'flags'])) {
$flagsArray = [];
foreach (self::SPL_FILE_OBJECT_FLAGS as $value => $name) {
if ($a[$prefix.'flags'] & $value) {
$flagsArray[] = $name;
}
}
$a[$prefix.'flags'] = new ConstStub(implode('|', $flagsArray), $a[$prefix.'flags']);
}
if (isset($a[$prefix.'fstat'])) {
$a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']);
}
return $a;
}
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested): array
{
$storage = [];
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
unset($a["\0SplObjectStorage\0storage"]);
$clone = clone $c;
foreach ($clone as $obj) {
$storage[] = new EnumStub([
'object' => $obj,
'info' => $clone->getInfo(),
]);
}
$a += [
Caster::PREFIX_VIRTUAL.'storage' => $storage,
];
return $a;
}
public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
return $a;
}
public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
return $a;
}
public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, bool $isNested): array
{
$map = [];
foreach (clone $c as $obj => $data) {
$map[] = new EnumStub([
'object' => $obj,
'data' => $data,
]);
}
$a += [
Caster::PREFIX_VIRTUAL.'map' => $map,
];
return $a;
}
private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$flags = $c->getFlags();
if (!($flags & \ArrayObject::STD_PROP_LIST)) {
$c->setFlags(\ArrayObject::STD_PROP_LIST);
$a = Caster::castObject($c, $c::class, method_exists($c, '__debugInfo'), $stub->class);
$c->setFlags($flags);
}
unset($a["\0ArrayObject\0storage"], $a["\0ArrayIterator\0storage"]);
$a += [
$prefix.'storage' => $c->getArrayCopy(),
$prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
$prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
];
if ($c instanceof \ArrayObject) {
$a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass());
}
return $a;
}
}
================================================
FILE: Caster/SqliteCaster.php
================================================
<?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;
/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*
* @internal
*/
final class SqliteCaster
{
public static function castSqlite3Result(\SQLite3Result $result, array $a, Stub $stub, bool $isNested): array
{
$numColumns = $result->numColumns();
for ($i = 0; $i < $numColumns; ++$i) {
$a[Caster::PREFIX_VIRTUAL.'columnNames'][$i] = $result->columnName($i);
}
return $a;
}
}
================================================
FILE: Caster/StubCaster.php
================================================
<?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 a caster's Stub.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class StubCaster
{
public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested): array
{
if ($isNested) {
$stub->type = $c->type;
$stub->class = $c->class;
$stub->value = $c->value;
$stub->handle = $c->handle;
$stub->cut = $c->cut;
$stub->attr = $c->attr;
if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) {
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
}
$a = [];
}
return $a;
}
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested): array
{
return $isNested ? $c->preservedSubset : $a;
}
public static function cutInternals($obj, array $a, Stub $stub, bool $isNested): array
{
if ($isNested) {
$stub->cut += \count($a);
return [];
}
return $a;
}
public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested): array
{
if ($isNested) {
$stub->class = $c->dumpKeys ? '' : null;
$stub->handle = 0;
$stub->value = null;
$stub->cut = $c->cut;
$stub->attr = $c->attr;
$a = [];
if ($c->value) {
foreach (array_keys($c->value) as $k) {
$keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
}
// Preserve references with array_combine()
$a = array_combine($keys, $c->value);
}
}
return $a;
}
public static function castScalar(ScalarStub $scalarStub, array $a, Stub $stub): array
{
$stub->type = Stub::TYPE_SCALAR;
$stub->attr['value'] = $scalarStub->value;
return $a;
}
}
================================================
FILE: Caster/SymfonyCaster.php
================================================
<?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\HttpFoundation\Request;
use Symfony\Component\Uid\TimeBasedUidInterface;
use Symfony\Component\Uid\Ulid;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarExporter\Internal\LazyObjectState;
/**
* @final
*
* @internal
*/
class SymfonyCaster
{
private const REQUEST_GETTERS = [
'pathInfo' => 'getPathInfo',
'requestUri' => 'getRequestUri',
'baseUrl' => 'getBaseUrl',
'basePath' => 'getBasePath',
'method' => 'getMethod',
'format' => 'getRequestFormat',
];
public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested): array
{
$clone = null;
foreach (self::REQUEST_GETTERS as $prop => $getter) {
$key = Caster::PREFIX_PROTECTED.$prop;
if (\array_key_exists($key, $a) && null === $a[$key]) {
$clone ??= clone $request;
$a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
}
}
return $a;
}
public static function castHttpClient($client, array $a, Stub $stub, bool $isNested): array
{
$multiKey = \sprintf("\0%s\0multi", $client::class);
if (isset($a[$multiKey]) && !$a[$multiKey] instanceof Stub) {
$a[$multiKey] = new CutStub($a[$multiKey]);
}
return $a;
}
public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested): array
{
$stub->cut += \count($a);
$a = [];
foreach ($response->getInfo() as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
return $a;
}
public static function castLazyObjectState($state, array $a, Stub $stub, bool $isNested): array
{
if (!$isNested) {
return $a;
}
$stub->cut += \count($a) - 1;
$instance = $a['realInstance'] ?? null;
if (isset($a['status'])) { // forward-compat with Symfony 8
$a = ['status' => new ConstStub(match ($a['status']) {
LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL',
LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL',
LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL',
LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL',
}, $a['status'])];
}
if ($instance) {
$a['realInstance'] = $instance;
--$stub->cut;
}
return $a;
}
public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'toBase58'] = $uuid->toBase58();
$a[Caster::PREFIX_VIRTUAL.'toBase32'] = $uuid->toBase32();
if ($uuid instanceof TimeBasedUidInterface) {
$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): array
{
$a[Caster::PREFIX_VIRTUAL.'toBase58'] = $ulid->toBase58();
$a[Caster::PREFIX_VIRTUAL.'toRfc4122'] = $ulid->toRfc4122();
if ($ulid instanceof TimeBasedUidInterface) {
$a[Caster::PREFIX_VIRTUAL.'time'] = $ulid->getDateTime()->format('Y-m-d H:i:s.v \U\T\C');
}
return $a;
}
}
================================================
FILE: Caster/TraceStub.php
================================================
<?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;
/**
* Represents a backtrace as returned by debug_backtrace() or Exception->getTrace().
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class TraceStub extends Stub
{
public function __construct(
array $trace,
public bool $keepArgs = true,
public int $sliceOffset = 0,
public ?int $sliceLength = null,
public int $numberingOffset = 0,
) {
$this->value = $trace;
}
}
================================================
FILE: Caster/UninitializedStub.php
================================================
<?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;
/**
* Represents an uninitialized property.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class UninitializedStub extends ConstStub
{
public function __construct(\ReflectionProperty $property)
{
parent::__construct('?'.($property->hasType() ? ' '.$property->getType() : ''), 'Uninitialized property');
}
}
================================================
FILE: Caster/UuidCaster.php
================================================
<?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 Ramsey\Uuid\UuidInterface;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @internal
*/
final class UuidCaster
{
public static function castRamseyUuid(UuidInterface $c, array $a, Stub $stub, bool $isNested): array
{
$a += [
Caster::PREFIX_VIRTUAL.'uuid' => (string) $c,
];
return $a;
}
}
================================================
FILE: Caster/VirtualStub.php
================================================
<?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;
class VirtualStub extends ConstStub
{
public function __construct(\ReflectionProperty $property)
{
parent::__construct('~'.($property->hasType() ? ' '.$property->getType() : ''), 'Virtual property');
$this->attr['virtual'] = true;
}
}
================================================
FILE: Caster/XmlReaderCaster.php
================================================
<?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 XmlReader class to array representation.
*
* @author Baptiste Clavié <clavie.b@gmail.com>
*
* @final
*
* @internal
*/
class XmlReaderCaster
{
private const NODE_TYPES = [
\XMLReader::NONE => 'NONE',
\XMLReader::ELEMENT => 'ELEMENT',
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
\XMLReader::TEXT => 'TEXT',
\XMLReader::CDATA => 'CDATA',
\XMLReader::ENTITY_REF => 'ENTITY_REF',
\XMLReader::ENTITY => 'ENTITY',
\XMLReader::PI => 'PI (Processing Instruction)',
\XMLReader::COMMENT => 'COMMENT',
\XMLReader::DOC => 'DOC',
\XMLReader::DOC_TYPE => 'DOC_TYPE',
\XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
\XMLReader::NOTATION => 'NOTATION',
\XMLReader::WHITESPACE => 'WHITESPACE',
\XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
\XMLReader::END_ELEMENT => 'END_ELEMENT',
\XMLReader::END_ENTITY => 'END_ENTITY',
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
];
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested): array
{
try {
$properties = [
'LOADDTD' => @$reader->getParserProperty(\XMLReader::LOADDTD),
'DEFAULTATTRS' => @$reader->getParserProperty(\XMLReader::DEFAULTATTRS),
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
];
} catch (\Error) {
$properties = [
'LOADDTD' => false,
'DEFAULTATTRS' => false,
'VALIDATE' => false,
'SUBST_ENTITIES' => false,
];
}
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
$info = [
'localName' => $reader->localName,
'prefix' => $reader->prefix,
'nodeType' => new ConstStub(self::NODE_TYPES[$reader->nodeType], $reader->nodeType),
'depth' => $reader->depth,
'isDefault' => $reader->isDefault,
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
'xmlLang' => $reader->xmlLang,
'attributeCount' => $reader->attributeCount,
'value' => $reader->value,
'namespaceURI' => $reader->namespaceURI,
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
$props => $properties,
];
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {
$info[$props] = new EnumStub($info[$props]);
$info[$props]->cut = $count;
}
$a = Caster::filter($a, Caster::EXCLUDE_UNINITIALIZED, [], $count);
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count);
// +2 because hasValue and hasAttributes are always filtered
$stub->cut += $count + 2;
return $a + $info;
}
}
================================================
FILE: Caster/XmlResourceCaster.php
================================================
<?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 XML resources to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class XmlResourceCaster
{
private const XML_ERRORS = [
\XML_ERROR_NONE => 'XML_ERROR_NONE',
\XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
\XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
\XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS',
\XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN',
\XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN',
\XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR',
\XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH',
\XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE',
\XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT',
\XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF',
\XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY',
\XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF',
\XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY',
\XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF',
\XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF',
\XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF',
\XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI',
\XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING',
\XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
\XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
\XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
];
public static function castXml($h, array $a, Stub $stub, bool $isNested): array
{
$a['current_byte_index'] = xml_get_current_byte_index($h);
$a['current_column_number'] = xml_get_current_column_number($h);
$a['current_line_number'] = xml_get_current_line_number($h);
$a['error_code'] = xml_get_error_code($h);
if (isset(self::XML_ERRORS[$a['error_code']])) {
$a['error_code'] = new ConstStub(self::XML_ERRORS[$a['error_code']], $a['error_code']);
}
return $a;
}
}
================================================
FILE: Cloner/AbstractCloner.php
================================================
<?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\Cloner;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
/**
* AbstractCloner implements a generic caster mechanism for objects and resources.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
abstract class AbstractCloner implements ClonerInterface
{
public static array $defaultCasters = [
'__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'],
'AddressInfo' => ['Symfony\Component\VarDumper\Caster\AddressInfoCaster', 'castAddressInfo'],
'Socket' => ['Symfony\Component\VarDumper\Caster\SocketCaster', 'castSocket'],
'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'],
'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'],
'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'],
'ReflectionProperty' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'],
'ReflectionReference' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReference'],
'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'],
'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'],
'Doctrine\Common\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'],
'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'],
'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'],
'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
'Dom\Exception' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
'Dom\Implementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\Node' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'],
'Dom\XMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXMLDocument'],
'Dom\HTMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castHTMLDocument'],
'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\NodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\DTDNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\XPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\HTMLCollection' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'Dom\TokenList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'],
'XMLReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'],
'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\AmpResponseV4' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
'Symfony\Component\HttpClient\Response\AmpResponseV5' => ['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\VarExporter\Internal\LazyObjectState' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castLazyObjectState'],
'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'],
'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'],
'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'],
'Ramsey\Uuid\UuidInterface' => ['Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'],
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'],
'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'],
'AMQPConnection' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'],
'AMQPChannel' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'],
'AMQPQueue' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'],
'AMQPExchange' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'],
'AMQPEnvelope' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'],
'ArrayObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'],
'ArrayIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'],
'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'],
'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'],
'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'],
'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'],
'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'],
'WeakMap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'],
'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'],
'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'Relay\Relay' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'],
'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'],
'DateTimeInterface' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'],
'DateInterval' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'],
'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'],
'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'],
'GMP' => ['Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'],
'MessageFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castMessageFormatter'],
'NumberFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castNumberFormatter'],
'IntlTimeZone' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlTimeZone'],
'IntlCalendar' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlCalendar'],
'IntlDateFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlDateFormatter'],
'Memcached' => ['Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'],
'Ds\Collection' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castCollection'],
'Ds\Map' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castMap'],
'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'],
'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],
'mysqli_driver' => ['Symfony\Component\VarDumper\Caster\MysqliCaster', 'castMysqliDriver'],
'CurlHandle' => ['Symfony\Component\VarDumper\Caster\CurlCaster', 'castCurl'],
'Dba\Connection' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
'GdImage' => ['Symfony\Component\VarDumper\Caster\GdCaster', 'castGd'],
'SQLite3Result' => ['Symfony\Component\VarDumper\Caster\SqliteCaster', 'castSqlite3Result'],
'PgSql\Lob' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
'PgSql\Connection' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
'PgSql\Result' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'],
':process' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'],
':stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
'OpenSSLAsymmetricKey' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslAsymmetricKey'],
'OpenSSLCertificateSigningRequest' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslCsr'],
'OpenSSLCertificate' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslX509'],
':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'],
'XmlParser' => ['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'],
'FFI\CData' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'],
'FFI\CType' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'],
];
protected int $maxItems = 2500;
protected int $maxString = -1;
protected int $minDepth = 1;
/**
* @var array<string, list<callable>>
*/
private array $casters = [];
/**
* @var callable|null
*/
private $prevErrorHandler;
private array $classInfo = [];
private int $filter = 0;
/**
* @param callable[]|null $casters A map of casters
*
* @see addCasters
*/
public function __construct(?array $casters = null)
{
$this->addCasters($casters ?? static::$defaultCasters);
}
/**
* Adds casters for resources and objects.
*
* Maps resources or object types to a callback.
* Use types as keys and callable casters as values.
* Prefix types with `::`,
* see e.g. self::$defaultCasters.
*
* @param array<string, callable> $casters A map of casters
*/
public function addCasters(array $casters): void
{
foreach ($casters as $type => $callback) {
$this->casters[$type][] = $callback;
}
}
/**
* Adds default casters for resources and objects.
*
* Maps resources or object types to a callback.
* Use types as keys and callable casters as values.
* Prefix types with `::`,
* see e.g. self::$defaultCasters.
*
* @param array<string, callable> $casters A map of casters
*/
public static function addDefaultCasters(array $casters): void
{
self::$defaultCasters = [...self::$defaultCasters, ...$casters];
}
/**
* Sets the maximum number of items to clone past the minimum depth in nested structures.
*/
public function setMaxItems(int $maxItems): void
{
$this->maxItems = $maxItems;
}
/**
* Sets the maximum cloned length for strings.
*/
public function setMaxString(int $maxString): void
{
$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.
*/
public function setMinDepth(int $minDepth): void
{
$this->minDepth = $minDepth;
}
/**
* Clones a PHP variable.
*
* @param int $filter A bit field of Caster::EXCLUDE_* constants
*/
public function cloneVar(mixed $var, int $filter = 0): Data
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $type, $file, $line);
}
if ($this->prevErrorHandler) {
return ($this->prevErrorHandler)($type, $msg, $file, $line, $context);
}
return false;
});
$this->filter = $filter;
if ($gc = gc_enabled()) {
gc_disable();
}
try {
return new Data($this->doClone($var));
} finally {
if ($gc) {
gc_enable();
}
restore_error_handler();
$this->prevErrorHandler = null;
}
}
/**
* Effectively clones the PHP variable.
*/
abstract protected function doClone(mixed $var): array;
/**
* Casts an object to an array representation.
*
* @param bool $isNested True if the object is nested in the dumped structure
*/
protected function castObject(Stub $stub, bool $isNested): array
{
$obj = $stub->value;
$class = $stub->class;
if (str_contains($class, "@anonymous\0")) {
$stub->class = get_debug_type($obj);
}
if (isset($this->classInfo[$class])) {
[$i, $parents, $hasDebugInfo, $fileInfo] = $this->classInfo[$class];
} else {
$i = 2;
$parents = [$class];
$hasDebugInfo = method_exists($class, '__debugInfo');
foreach (class_parents($class) as $p) {
$parents[] = $p;
++$i;
}
foreach (class_implements($class) as $p) {
$parents[] = $p;
++$i;
}
$parents[] = '*';
$r = new \ReflectionClass($class);
$fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : [
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
];
$this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo];
}
$stub->attr += $fileInfo;
$a = Caster::castObject($obj, $class, $hasDebugInfo, $stub->class);
try {
while ($i--) {
if (!empty($this->casters[$p = $parents[$i]])) {
foreach ($this->casters[$p] as $callback) {
$a = $callback($obj, $a, $stub, $isNested, $this->filter);
}
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
}
/**
* Casts a resource to an array representation.
*
* @param bool $isNested True if the object is nested in the dumped structure
*/
protected function castResource(Stub $stub, bool $isNested): array
{
$a = [];
$res = $stub->value;
$type = $stub->class;
try {
if (!empty($this->casters[':'.$type])) {
foreach ($this->casters[':'.$type] as $callback) {
$a = $callback($res, $a, $stub, $isNested, $this->filter);
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
}
}
================================================
FILE: Cloner/ClonerInterface.php
================================================
<?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\Cloner;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
interface ClonerInterface
{
/**
* Clones a PHP variable.
*/
public function cloneVar(mixed $var): Data;
}
================================================
FILE: Cloner/Cursor.php
================================================
<?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\Cloner;
/**
* Represents the current state of a dumper while dumping.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class Cursor
{
public const HASH_INDEXED = Stub::ARRAY_INDEXED;
public const HASH_ASSOC = Stub::ARRAY_ASSOC;
public const HASH_OBJECT = Stub::TYPE_OBJECT;
public const HASH_RESOURCE = Stub::TYPE_RESOURCE;
public int $depth = 0;
public int $refIndex = 0;
public int $softRefTo = 0;
public int $softRefCount = 0;
public int $softRefHandle = 0;
public int $hardRefTo = 0;
public int $hardRefCount = 0;
public int $hardRefHandle = 0;
public int $hashType;
public string|int|null $hashKey = null;
public bool $hashKeyIsBinary;
public int $hashIndex = 0;
public int $hashLength = 0;
public int $hashCut = 0;
public bool $stop = false;
public array $attr = [];
public bool $skipChildren = false;
}
================================================
FILE: Cloner/Data.php
================================================
<?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\Cloner;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
{
private array $data;
private int $position = 0;
private int|string $key = 0;
private int $maxDepth = 20;
private int $maxItemsPerDepth = -1;
private int $useRefHandles = -1;
private array $context = [];
/**
* @param array $data An array as returned by ClonerInterface::cloneVar()
*/
public function __construct(array $data)
{
$this->data = $data;
}
public function getType(): ?string
{
$item = $this->data[$this->position][$this->key];
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!$item instanceof Stub) {
return \gettype($item);
}
if (Stub::TYPE_STRING === $item->type) {
return 'string';
}
if (Stub::TYPE_ARRAY === $item->type) {
return 'array';
}
if (Stub::TYPE_OBJECT === $item->type) {
return $item->class;
}
if (Stub::TYPE_RESOURCE === $item->type) {
return $item->class.' resource';
}
return null;
}
/**
* 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
*/
public function getValue(array|bool $recursive = false): string|int|float|bool|array|null
{
$item = $this->data[$this->position][$this->key];
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!($item = $this->getStub($item)) instanceof Stub) {
return $item;
}
if (Stub::TYPE_STRING === $item->type) {
return $item->value;
}
$children = $item->position ? $this->data[$item->position] : [];
foreach ($children as $k => $v) {
if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
continue;
}
$children[$k] = clone $this;
$children[$k]->key = $k;
$children[$k]->position = $item->position;
if ($recursive) {
if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
$recursive = (array) $recursive;
if (isset($recursive[$v->position])) {
continue;
}
$recursive[$v->position] = true;
}
$children[$k] = $children[$k]->getValue($recursive);
}
}
return $children;
}
public function count(): int
{
return \count($this->getValue());
}
public function getIterator(): \Traversable
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(\sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
}
yield from $value;
}
public function __get(string $key): mixed
{
if (null !== $data = $this->seek($key)) {
$item = $this->getStub($data->data[$data->position][$data->key]);
return $item instanceof Stub || [] === $item ? $data : $item;
}
return null;
}
public function __isset(string $key): bool
{
return null !== $this->seek($key);
}
public function offsetExists(mixed $key): bool
{
return $this->__isset($key);
}
public function offsetGet(mixed $key): mixed
{
return $this->__get($key);
}
public function offsetSet(mixed $key, mixed $value): void
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}
public function offsetUnset(mixed $key): void
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}
public function __toString(): string
{
$value = $this->getValue();
if (!\is_array($value)) {
return (string) $value;
}
return \sprintf('%s (count=%d)', $this->getType(), \count($value));
}
/**
* Returns a depth limited clone of $this.
*/
public function withMaxDepth(int $maxDepth): static
{
$data = clone $this;
$data->maxDepth = $maxDepth;
return $data;
}
/**
* Limits the number of elements per depth level.
*/
public function withMaxItemsPerDepth(int $maxItemsPerDepth): static
{
$data = clone $this;
$data->maxItemsPerDepth = $maxItemsPerDepth;
return $data;
}
/**
* Enables/disables objects' identifiers tracking.
*
* @param bool $useRefHandles False to hide global ref. handles
*/
public function withRefHandles(bool $useRefHandles): static
{
$data = clone $this;
$data->useRefHandles = $useRefHandles ? -1 : 0;
return $data;
}
public function withContext(array $context): static
{
$data = clone $this;
$data->context = $context;
return $data;
}
public function getContext(): array
{
return $this->context;
}
/**
* Seeks to a specific key in nested data structures.
*/
public function seek(string|int $key): ?static
{
$item = $this->data[$this->position][$this->key];
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) {
return null;
}
$keys = [$key];
switch ($item->type) {
case Stub::TYPE_OBJECT:
$keys[] = Caster::PREFIX_DYNAMIC.$key;
$keys[] = Caster::PREFIX_PROTECTED.$key;
$keys[] = Caster::PREFIX_VIRTUAL.$key;
$keys[] = "\0$item->class\0$key";
// no break
case Stub::TYPE_ARRAY:
case Stub::TYPE_RESOURCE:
break;
default:
return null;
}
$data = null;
$children = $this->data[$item->position];
foreach ($keys as $key) {
if (isset($children[$key]) || \array_key_exists($key, $children)) {
$data = clone $this;
$data->key = $key;
$data->position = $item->position;
break;
}
}
return $data;
}
/**
* Dumps data with a DumperInterface dumper.
*/
public function dump(DumperInterface $dumper): void
{
$refs = [0];
$cursor = new Cursor();
$cursor->hashType = -1;
$cursor->attr = $this->context[SourceContextProvider::class] ?? [];
$label = $this->context['label'] ?? '';
if ($cursor->attr || '' !== $label) {
$dumper->dumpScalar($cursor, 'label', $label);
}
$cursor->hashType = 0;
$this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]);
}
/**
* Depth-first dumping of items.
*
* @param mixed $item A Stub object or the original value being dumped
*/
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void
{
$cursor->refIndex = 0;
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
$cursor->hardRefTo = $cursor->hardRefHandle = $cursor->hardRefCount = 0;
$firstSeen = true;
if (!$item instanceof Stub) {
$cursor->attr = [];
$type = \gettype($item);
if ('array' === $type && $item) {
$item = $this->getStub($item);
}
} elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) {
if (!isset($refs[$r = $item->handle - (\PHP_INT_MAX >> 1)])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else {
$firstSeen = false;
}
$cursor->hardRefTo = $refs[$r];
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
$cursor->hardRefCount = 0 < $item->handle ? $item->refCount : 0;
}
$cursor->attr = $item->attr;
$type = $item->class ?: \gettype($item->value);
$item = $this->getStub($item->value);
}
if ($item instanceof Stub) {
if ($item->refCount) {
if (!isset($refs[$r = $item->handle])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else {
$firstSeen = false;
}
$cursor->softRefTo = $refs[$r];
}
$cursor->softRefHandle = $this->useRefHandles & $item->handle;
$cursor->softRefCount = $item->refCount;
$cursor->attr = $item->attr;
$cut = $item->cut;
if ($item->position && $firstSeen) {
$children = $this->data[$item->position];
if ($cursor->stop) {
if ($cut >= 0) {
$cut += \count($children);
}
$children = [];
}
} else {
$children = [];
}
switch ($item->type) {
case Stub::TYPE_STRING:
$dumper->dumpString($cursor, $item->value, Stub::STRING_BINARY === $item->class, $cut);
break;
case Stub::TYPE_ARRAY:
$item = clone $item;
$item->type = $item->class;
$item->class = $item->value;
// no break
case Stub::TYPE_OBJECT:
case Stub::TYPE_RESOURCE:
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
if ($withChildren) {
if ($cursor->skipChildren) {
$withChildren = false;
$cut = -1;
} else {
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
}
} elseif ($children && 0 <= $cut) {
$cut += \count($children);
}
$cursor->skipChildren = false;
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
break;
case Stub::TYPE_SCALAR:
$dumper->dumpScalar($cursor, 'default', $item->attr['value']);
break;
default:
throw new \RuntimeException(\sprintf('Unexpected Stub type: "%s".', $item->type));
}
} elseif ('array' === $type) {
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);
$dumper->leaveHash($cursor, Cursor::HASH_INDEXED, 0, false, 0);
} elseif ('string' === $type) {
$dumper->dumpString($cursor, $item, false, 0);
} else {
$dumper->dumpScalar($cursor, $type, $item);
}
}
/**
* Dumps children of hash structures.
*
* @return int The final number of removed items
*/
private function dumpChildren(DumperInterface $dumper, Cursor $parentCursor, array &$refs, array $children, int $hashCut, int $hashType, bool $dumpKeys): int
{
$cursor = clone $parentCursor;
++$cursor->depth;
$cursor->hashType = $hashType;
$cursor->hashIndex = 0;
$cursor->hashLength = \count($children);
$cursor->hashCut = $hashCut;
foreach ($children as $key => $child) {
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);
$cursor->hashKey = $dumpKeys ? $key : null;
$this->dumpItem($dumper, $cursor, $refs, $child);
if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) {
$parentCursor->stop = true;
return $hashCut >= 0 ? $hashCut + $cursor->hashLength - $cursor->hashIndex : $hashCut;
}
}
return $hashCut;
}
private function getStub(mixed $item): mixed
{
if (!$item || !\is_array($item)) {
return $item;
}
$stub = new Stub();
$stub->type = Stub::TYPE_ARRAY;
foreach ($item as $stub->class => $stub->position) {
}
if (isset($item[0])) {
$stub->cut = $item[0];
}
$stub->value = $stub->cut + ($stub->position ? \count($this->data[$stub->position]) : 0);
return $stub;
}
}
================================================
FILE: Cloner/DumperInterface.php
================================================
<?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\Cloner;
/**
* DumperInterface used by Data objects.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
interface DumperInterface
{
/**
*
gitextract_7b4gxnj_/ ├── .gitattributes ├── .github/ │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ └── close-pull-request.yml ├── .gitignore ├── CHANGELOG.md ├── Caster/ │ ├── AddressInfoCaster.php │ ├── AmqpCaster.php │ ├── ArgsStub.php │ ├── Caster.php │ ├── ClassStub.php │ ├── ConstStub.php │ ├── CurlCaster.php │ ├── CutArrayStub.php │ ├── CutStub.php │ ├── DOMCaster.php │ ├── DateCaster.php │ ├── DoctrineCaster.php │ ├── DsCaster.php │ ├── DsPairStub.php │ ├── EnumStub.php │ ├── ExceptionCaster.php │ ├── FFICaster.php │ ├── FiberCaster.php │ ├── FrameStub.php │ ├── GdCaster.php │ ├── GmpCaster.php │ ├── ImagineCaster.php │ ├── ImgStub.php │ ├── IntlCaster.php │ ├── LinkStub.php │ ├── MemcachedCaster.php │ ├── MysqliCaster.php │ ├── OpenSSLCaster.php │ ├── PdoCaster.php │ ├── PgSqlCaster.php │ ├── ProxyManagerCaster.php │ ├── RdKafkaCaster.php │ ├── RedisCaster.php │ ├── ReflectionCaster.php │ ├── ResourceCaster.php │ ├── ScalarStub.php │ ├── SocketCaster.php │ ├── SplCaster.php │ ├── SqliteCaster.php │ ├── StubCaster.php │ ├── SymfonyCaster.php │ ├── TraceStub.php │ ├── UninitializedStub.php │ ├── UuidCaster.php │ ├── VirtualStub.php │ ├── XmlReaderCaster.php │ └── XmlResourceCaster.php ├── Cloner/ │ ├── AbstractCloner.php │ ├── ClonerInterface.php │ ├── Cursor.php │ ├── Data.php │ ├── DumperInterface.php │ ├── Stub.php │ └── VarCloner.php ├── Command/ │ ├── Descriptor/ │ │ ├── CliDescriptor.php │ │ ├── DumpDescriptorInterface.php │ │ └── HtmlDescriptor.php │ └── ServerDumpCommand.php ├── Dumper/ │ ├── AbstractDumper.php │ ├── CliDumper.php │ ├── ContextProvider/ │ │ ├── CliContextProvider.php │ │ ├── ContextProviderInterface.php │ │ ├── RequestContextProvider.php │ │ └── SourceContextProvider.php │ ├── ContextualizedDumper.php │ ├── DataDumperInterface.php │ ├── HtmlDumper.php │ └── ServerDumper.php ├── Exception/ │ └── ThrowingCasterException.php ├── LICENSE ├── README.md ├── Resources/ │ ├── bin/ │ │ └── var-dump-server │ ├── css/ │ │ └── htmlDescriptor.css │ ├── functions/ │ │ └── dump.php │ └── js/ │ └── htmlDescriptor.js ├── Server/ │ ├── Connection.php │ └── DumpServer.php ├── Test/ │ └── VarDumperTestTrait.php ├── Tests/ │ ├── Caster/ │ │ ├── AddressInfoCasterTest.php │ │ ├── CasterTest.php │ │ ├── CurlCasterTest.php │ │ ├── DOMCasterTest.php │ │ ├── DateCasterTest.php │ │ ├── DoctrineCasterTest.php │ │ ├── ExceptionCasterTest.php │ │ ├── FFICasterTest.php │ │ ├── FiberCasterTest.php │ │ ├── GmpCasterTest.php │ │ ├── IntlCasterTest.php │ │ ├── MemcachedCasterTest.php │ │ ├── MysqliCasterTest.php │ │ ├── OpenSSLCasterTest.php │ │ ├── PdoCasterTest.php │ │ ├── RdKafkaCasterTest.php │ │ ├── RedisCasterTest.php │ │ ├── ReflectionCasterTest.php │ │ ├── ResourceCasterTest.php │ │ ├── SocketCasterTest.php │ │ ├── SplCasterTest.php │ │ ├── SqliteCasterTest.php │ │ ├── StubCasterTest.php │ │ ├── SymfonyCasterTest.php │ │ └── XmlReaderCasterTest.php │ ├── Cloner/ │ │ ├── DataTest.php │ │ ├── StubTest.php │ │ └── VarClonerTest.php │ ├── Command/ │ │ ├── Descriptor/ │ │ │ ├── CliDescriptorTest.php │ │ │ └── HtmlDescriptorTest.php │ │ └── ServerDumpCommandTest.php │ ├── Dumper/ │ │ ├── CliDumperTest.php │ │ ├── ContextProvider/ │ │ │ └── RequestContextProviderTest.php │ │ ├── ContextualizedDumperTest.php │ │ ├── FunctionsTest.php │ │ ├── HtmlDumperTest.php │ │ ├── ServerDumperTest.php │ │ └── functions/ │ │ ├── dd_with_accept_header_json_array.phpt │ │ ├── dd_with_multiple_args.phpt │ │ ├── dd_with_named_args.phpt │ │ ├── dd_with_null.phpt │ │ ├── dd_with_single_arg.phpt │ │ ├── dump_data_collector_with_spl_array.phpt │ │ ├── dump_with_accept_header_html.phpt │ │ ├── dump_with_accept_header_json_array.phpt │ │ ├── dump_with_accept_header_json_multiple_args.phpt │ │ ├── dump_with_accept_header_json_string.phpt │ │ ├── dump_with_accept_header_wildcard.phpt │ │ ├── dump_with_multiple_args.phpt │ │ ├── dump_with_named_args.phpt │ │ ├── dump_with_null.phpt │ │ ├── dump_with_single_arg.phpt │ │ └── dump_without_args.phpt │ ├── Fixtures/ │ │ ├── BackedEnumFixture.php │ │ ├── DateTimeChild.php │ │ ├── ExtendsReflectionTypeFixture.php │ │ ├── FooInterface.php │ │ ├── GeneratorDemo.php │ │ ├── LotsOfAttributes.php │ │ ├── MyAttribute.php │ │ ├── NotLoadableClass.php │ │ ├── Php74.php │ │ ├── Php81Enums.php │ │ ├── Php82NullStandaloneReturnType.php │ │ ├── ReflectionIntersectionTypeFixture.php │ │ ├── ReflectionNamedTypeFixture.php │ │ ├── ReflectionUnionTypeFixture.php │ │ ├── ReflectionUnionTypeWithIntersectionFixture.php │ │ ├── Twig.php │ │ ├── UnitEnumFixture.php │ │ ├── VirtualProperty.php │ │ ├── dumb-var.php │ │ ├── dump_server.php │ │ └── xml_reader.xml │ ├── Server/ │ │ └── ConnectionTest.php │ └── Test/ │ └── VarDumperTestTraitTest.php ├── VarDumper.php ├── composer.json └── phpunit.xml.dist
SYMBOL INDEX (707 symbols across 130 files)
FILE: Caster/AddressInfoCaster.php
class AddressInfoCaster (line 21) | final class AddressInfoCaster
method castAddressInfo (line 56) | public static function castAddressInfo(\AddressInfo $h, array $a, Stub...
FILE: Caster/AmqpCaster.php
class AmqpCaster (line 25) | class AmqpCaster
method castConnection (line 51) | public static function castConnection(\AMQPConnection $c, array $a, St...
method castChannel (line 84) | public static function castChannel(\AMQPChannel $c, array $a, Stub $st...
method castQueue (line 107) | public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, ...
method castExchange (line 130) | public static function castExchange(\AMQPExchange $c, array $a, Stub $...
method castEnvelope (line 158) | public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $...
method extractFlags (line 198) | private static function extractFlags(int $flags): ConstStub
FILE: Caster/ArgsStub.php
class ArgsStub (line 21) | class ArgsStub extends EnumStub
method __construct (line 25) | public function __construct(array $args, string $function, ?string $cl...
method getParameters (line 51) | private static function getParameters(string $function, ?string $class...
FILE: Caster/Caster.php
class Caster (line 23) | class Caster
method castObject (line 52) | public static function castObject(object $obj, string $class, bool $ha...
method filter (line 124) | public static function filter(array $a, int $filter, array $listedProp...
method castPhpIncompleteClass (line 170) | public static function castPhpIncompleteClass(\__PHP_Incomplete_Class ...
method getClassProperties (line 180) | private static function getClassProperties(\ReflectionClass $class): a...
FILE: Caster/ClassStub.php
class ClassStub (line 21) | class ClassStub extends ConstStub
method __construct (line 27) | public function __construct(string $identifier, callable|array|string|...
method wrapCallable (line 88) | public static function wrapCallable(mixed $callable): mixed
FILE: Caster/ConstStub.php
class ConstStub (line 21) | class ConstStub extends Stub
method __construct (line 23) | public function __construct(string $name, string|int|float|null $value...
method __toString (line 29) | public function __toString(): string
method fromBitfield (line 37) | public static function fromBitfield(int $value, array $values): self
FILE: Caster/CurlCaster.php
class CurlCaster (line 21) | final class CurlCaster
method castCurl (line 23) | public static function castCurl(\CurlHandle $h, array $a, Stub $stub, ...
FILE: Caster/CutArrayStub.php
class CutArrayStub (line 19) | class CutArrayStub extends CutStub
method __construct (line 23) | public function __construct(array $value, array $preservedKeys)
FILE: Caster/CutStub.php
class CutStub (line 21) | class CutStub extends Stub
method __construct (line 23) | public function __construct(mixed $value)
FILE: Caster/DOMCaster.php
class DOMCaster (line 25) | class DOMCaster
method castException (line 68) | public static function castException(\DOMException|\Dom\Exception $e, ...
method castLength (line 78) | public static function castLength($dom, array $a, Stub $stub, bool $is...
method castImplementation (line 83) | public static function castImplementation(\DOMImplementation|\Dom\Impl...
method castNode (line 93) | public static function castNode(\DOMNode|\Dom\Node $dom, array $a, Stu...
method castNameSpaceNode (line 98) | public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array...
method castDocument (line 103) | public static function castDocument(\DOMDocument $dom, array $a, Stub ...
method castXMLDocument (line 115) | public static function castXMLDocument(\Dom\XMLDocument $dom, array $a...
method castHTMLDocument (line 127) | public static function castHTMLDocument(\Dom\HTMLDocument $dom, array ...
method castCharacterData (line 136) | public static function castCharacterData(\DOMCharacterData|\Dom\Charac...
method castAttr (line 141) | public static function castAttr(\DOMAttr|\Dom\Attr $dom, array $a, Stu...
method castElement (line 146) | public static function castElement(\DOMElement|\Dom\Element $dom, arra...
method castText (line 151) | public static function castText(\DOMText|\Dom\Text $dom, array $a, Stu...
method castDocumentType (line 156) | public static function castDocumentType(\DOMDocumentType|\Dom\Document...
method castNotation (line 161) | public static function castNotation(\DOMNotation|\Dom\Notation $dom, a...
method castEntity (line 166) | public static function castEntity(\DOMEntity|\Dom\Entity $dom, array $...
method castProcessingInstruction (line 171) | public static function castProcessingInstruction(\DOMProcessingInstruc...
method castXPath (line 176) | public static function castXPath(\DOMXPath|\Dom\XPath $dom, array $a, ...
method castDom (line 181) | public static function castDom($dom, array $a, Stub $stub, bool $isNes...
FILE: Caster/DateCaster.php
class DateCaster (line 25) | class DateCaster
method castDateTime (line 29) | public static function castDateTime(\DateTimeInterface $d, array $a, S...
method castInterval (line 52) | public static function castInterval(\DateInterval $interval, array $a,...
method formatInterval (line 63) | private static function formatInterval(\DateInterval $i): string
method castTimeZone (line 81) | public static function castTimeZone(\DateTimeZone $timeZone, array $a,...
method castPeriod (line 92) | public static function castPeriod(\DatePeriod $p, array $a, Stub $stub...
method formatDateTime (line 120) | private static function formatDateTime(\DateTimeInterface $d, string $...
method formatSeconds (line 125) | private static function formatSeconds(string $s, string $us): string
FILE: Caster/DoctrineCaster.php
class DoctrineCaster (line 28) | class DoctrineCaster
method castCommonProxy (line 30) | public static function castCommonProxy(CommonProxy $proxy, array $a, S...
method castOrmProxy (line 42) | public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $s...
method castPersistentCollection (line 54) | public static function castPersistentCollection(PersistentCollection $...
FILE: Caster/DsCaster.php
class DsCaster (line 26) | class DsCaster
method castCollection (line 28) | public static function castCollection(Collection $c, array $a, Stub $s...
method castMap (line 40) | public static function castMap(Map $c, array $a, Stub $stub, bool $isN...
method castPair (line 49) | public static function castPair(Pair $c, array $a, Stub $stub, bool $i...
method castPairStub (line 58) | public static function castPairStub(DsPairStub $c, array $a, Stub $stu...
FILE: Caster/DsPairStub.php
class DsPairStub (line 19) | class DsPairStub extends Stub
method __construct (line 21) | public function __construct(mixed $key, mixed $value)
FILE: Caster/EnumStub.php
class EnumStub (line 21) | class EnumStub extends Stub
method __construct (line 23) | public function __construct(
FILE: Caster/ExceptionCaster.php
class ExceptionCaster (line 28) | class ExceptionCaster
method castError (line 52) | public static function castError(\Error $e, array $a, Stub $stub, bool...
method castException (line 57) | public static function castException(\Exception $e, array $a, Stub $st...
method castErrorException (line 62) | public static function castErrorException(\ErrorException $e, array $a...
method castThrowingCasterException (line 71) | public static function castThrowingCasterException(ThrowingCasterExcep...
method castSilencedErrorContext (line 89) | public static function castSilencedErrorContext(SilencedErrorContext $...
method castTraceStub (line 116) | public static function castTraceStub(TraceStub $trace, array $a, Stub ...
method castFrameStub (line 190) | public static function castFrameStub(FrameStub $frame, array $a, Stub ...
method castFlattenException (line 273) | public static function castFlattenException(FlattenException $e, array...
method filterExceptionArray (line 283) | private static function filterExceptionArray(string $xClass, array $a,...
method traceUnshift (line 314) | private static function traceUnshift(array &$trace, ?string $class, st...
method extractSource (line 326) | private static function extractSource(string $srcLines, int $line, int...
FILE: Caster/FFICaster.php
class FFICaster (line 23) | final class FFICaster
method castCTypeOrCData (line 35) | public static function castCTypeOrCData(CData|CType $data, array $args...
method castFFIFunction (line 68) | private static function castFFIFunction(Stub $stub, CType $type): array
method castFFIPointer (line 100) | private static function castFFIPointer(Stub $stub, CType $type, ?CData...
method castFFIStringValue (line 115) | private static function castFFIStringValue(CData $data): string|CutStub
method castFFIStructLike (line 145) | private static function castFFIStructLike(CType $type, ?CData $data = ...
FILE: Caster/FiberCaster.php
class FiberCaster (line 21) | final class FiberCaster
method castFiber (line 23) | public static function castFiber(\Fiber $fiber, array $a, Stub $stub, ...
FILE: Caster/FrameStub.php
class FrameStub (line 19) | class FrameStub extends EnumStub
method __construct (line 21) | public function __construct(
FILE: Caster/GdCaster.php
class GdCaster (line 21) | final class GdCaster
method castGd (line 23) | public static function castGd(\GdImage $gd, array $a, Stub $stub, bool...
FILE: Caster/GmpCaster.php
class GmpCaster (line 26) | class GmpCaster
method castGmp (line 28) | public static function castGmp(\GMP $gmp, array $a, Stub $stub, bool $...
FILE: Caster/ImagineCaster.php
class ImagineCaster (line 22) | final class ImagineCaster
method castImage (line 24) | public static function castImage(ImageInterface $c, array $a, Stub $st...
FILE: Caster/ImgStub.php
class ImgStub (line 17) | class ImgStub extends ConstStub
method __construct (line 19) | public function __construct(string $data, string $contentType, string ...
FILE: Caster/IntlCaster.php
class IntlCaster (line 24) | class IntlCaster
method castMessageFormatter (line 26) | public static function castMessageFormatter(\MessageFormatter $c, arra...
method castNumberFormatter (line 36) | public static function castNumberFormatter(\NumberFormatter $c, array ...
method castIntlTimeZone (line 113) | public static function castIntlTimeZone(\IntlTimeZone $c, array $a, St...
method castIntlCalendar (line 130) | public static function castIntlCalendar(\IntlCalendar $c, array $a, St...
method castIntlDateFormatter (line 147) | public static function castIntlDateFormatter(\IntlDateFormatter $c, ar...
method castError (line 163) | private static function castError(object $c, array $a): array
FILE: Caster/LinkStub.php
class LinkStub (line 19) | class LinkStub extends ConstStub
method __construct (line 26) | public function __construct(string $label, int $line = 0, ?string $hre...
method getComposerRoot (line 63) | private function getComposerRoot(string $file, bool &$inVendor): strin...
FILE: Caster/MemcachedCaster.php
class MemcachedCaster (line 23) | class MemcachedCaster
method castMemcached (line 28) | public static function castMemcached(\Memcached $c, array $a, Stub $st...
method getNonDefaultOptions (line 40) | private static function getNonDefaultOptions(\Memcached $c): array
method discoverDefaultOptions (line 55) | private static function discoverDefaultOptions(): array
method getOptionConstants (line 70) | private static function getOptionConstants(): array
FILE: Caster/MysqliCaster.php
class MysqliCaster (line 21) | final class MysqliCaster
method castMysqliDriver (line 23) | public static function castMysqliDriver(\mysqli_driver $c, array $a, S...
FILE: Caster/OpenSSLCaster.php
class OpenSSLCaster (line 22) | final class OpenSSLCaster
method castOpensslX509 (line 24) | public static function castOpensslX509(\OpenSSLCertificate $h, array $...
method castOpensslAsymmetricKey (line 50) | public static function castOpensslAsymmetricKey(\OpenSSLAsymmetricKey ...
method castOpensslCsr (line 61) | public static function castOpensslCsr(\OpenSSLCertificateSigningReques...
FILE: Caster/PdoCaster.php
class PdoCaster (line 25) | class PdoCaster
method castPdo (line 64) | public static function castPdo(\PDO $c, array $a, Stub $stub, bool $is...
method castPdoStatement (line 113) | public static function castPdoStatement(\PDOStatement $c, array $a, St...
FILE: Caster/PgSqlCaster.php
class PgSqlCaster (line 25) | class PgSqlCaster
method castLargeObject (line 74) | public static function castLargeObject($lo, array $a, Stub $stub, bool...
method castLink (line 81) | public static function castLink($link, array $a, Stub $stub, bool $isN...
method castResult (line 113) | public static function castResult($result, array $a, Stub $stub, bool ...
FILE: Caster/ProxyManagerCaster.php
class ProxyManagerCaster (line 24) | class ProxyManagerCaster
method castProxy (line 26) | public static function castProxy(ProxyInterface $c, array $a, Stub $st...
FILE: Caster/RdKafkaCaster.php
class RdKafkaCaster (line 34) | class RdKafkaCaster
method castKafkaConsumer (line 36) | public static function castKafkaConsumer(KafkaConsumer $c, array $a, S...
method castTopic (line 56) | public static function castTopic(Topic $c, array $a, Stub $stub, bool ...
method castTopicPartition (line 67) | public static function castTopicPartition(TopicPartition $c, array $a)...
method castMessage (line 80) | public static function castMessage(Message $c, array $a, Stub $stub, b...
method castConf (line 91) | public static function castConf(Conf $c, array $a, Stub $stub, bool $i...
method castTopicConf (line 102) | public static function castTopicConf(TopicConf $c, array $a, Stub $stu...
method castRdKafka (line 113) | public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, ...
method castCollectionMetadata (line 126) | public static function castCollectionMetadata(CollectionMetadata $c, a...
method castTopicMetadata (line 133) | public static function castTopicMetadata(TopicMetadata $c, array $a, S...
method castPartitionMetadata (line 145) | public static function castPartitionMetadata(PartitionMetadata $c, arr...
method castBrokerMetadata (line 158) | public static function castBrokerMetadata(BrokerMetadata $c, array $a,...
method extractMetadata (line 171) | private static function extractMetadata(KafkaConsumer|\RdKafka $c): array
FILE: Caster/RedisCaster.php
class RedisCaster (line 26) | class RedisCaster
method castRedis (line 52) | public static function castRedis(\Redis|Relay $c, array $a, Stub $stub...
method castRedisArray (line 78) | public static function castRedisArray(\RedisArray $c, array $a, Stub $...
method castRedisCluster (line 90) | public static function castRedisCluster(\RedisCluster $c, array $a, St...
method getRedisOptions (line 108) | private static function getRedisOptions(\Redis|Relay|\RedisArray|\Redi...
FILE: Caster/ReflectionCaster.php
class ReflectionCaster (line 25) | class ReflectionCaster
method castClosure (line 40) | public static function castClosure(\Closure $c, array $a, Stub $stub, ...
method unsetClosureFileInfo (line 76) | public static function unsetClosureFileInfo(\Closure $c, array $a): array
method castGenerator (line 83) | public static function castGenerator(\Generator $c, array $a, Stub $st...
method castType (line 97) | public static function castType(\ReflectionType $c, array $a, Stub $st...
method castAttribute (line 119) | public static function castAttribute(\ReflectionAttribute $c, array $a...
method castReflectionGenerator (line 130) | public static function castReflectionGenerator(\ReflectionGenerator $c...
method castClass (line 165) | public static function castClass(\ReflectionClass $c, array $a, Stub $...
method castFunctionAbstract (line 196) | public static function castFunctionAbstract(\ReflectionFunctionAbstrac...
method castClassConstant (line 254) | public static function castClassConstant(\ReflectionClassConstant $c, ...
method castMethod (line 264) | public static function castMethod(\ReflectionMethod $c, array $a, Stub...
method castParameter (line 271) | public static function castParameter(\ReflectionParameter $c, array $a...
method castProperty (line 311) | public static function castProperty(\ReflectionProperty $c, array $a, ...
method castReference (line 321) | public static function castReference(\ReflectionReference $c, array $a...
method castExtension (line 328) | public static function castExtension(\ReflectionExtension $c, array $a...
method castZendExtension (line 344) | public static function castZendExtension(\ReflectionZendExtension $c, ...
method getSignature (line 356) | public static function getSignature(array $a): string
method addExtra (line 408) | private static function addExtra(array &$a, \Reflector $c): void
method addMap (line 424) | private static function addMap(array &$a, object $c, array $map, strin...
method addAttributes (line 437) | private static function addAttributes(array &$a, \Reflector $c, string...
FILE: Caster/ResourceCaster.php
class ResourceCaster (line 25) | class ResourceCaster
method castDba (line 27) | public static function castDba(\Dba\Connection $dba, array $a, Stub $s...
method castProcess (line 40) | public static function castProcess($process, array $a, Stub $stub, boo...
method castStream (line 45) | public static function castStream($stream, array $a, Stub $stub, bool ...
method castStreamContext (line 55) | public static function castStreamContext($stream, array $a, Stub $stub...
FILE: Caster/ScalarStub.php
class ScalarStub (line 21) | class ScalarStub extends Stub
method __construct (line 23) | public function __construct(mixed $value)
FILE: Caster/SocketCaster.php
class SocketCaster (line 22) | final class SocketCaster
method castSocket (line 24) | public static function castSocket(\Socket $socket, array $a, Stub $stu...
FILE: Caster/SplCaster.php
class SplCaster (line 25) | class SplCaster
method castArrayObject (line 34) | public static function castArrayObject(\ArrayObject $c, array $a, Stub...
method castArrayIterator (line 39) | public static function castArrayIterator(\ArrayIterator $c, array $a, ...
method castHeap (line 44) | public static function castHeap(\Iterator $c, array $a, Stub $stub, bo...
method castDoublyLinkedList (line 53) | public static function castDoublyLinkedList(\SplDoublyLinkedList $c, a...
method castFileInfo (line 68) | public static function castFileInfo(\SplFileInfo $c, array $a, Stub $s...
method castFileObject (line 144) | public static function castFileObject(\SplFileObject $c, array $a, Stu...
method castObjectStorage (line 181) | public static function castObjectStorage(\SplObjectStorage $c, array $...
method castOuterIterator (line 202) | public static function castOuterIterator(\OuterIterator $c, array $a, ...
method castWeakReference (line 209) | public static function castWeakReference(\WeakReference $c, array $a, ...
method castWeakMap (line 216) | public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, ...
method castSplArray (line 234) | private static function castSplArray(\ArrayObject|\ArrayIterator $c, a...
FILE: Caster/SqliteCaster.php
class SqliteCaster (line 21) | final class SqliteCaster
method castSqlite3Result (line 23) | public static function castSqlite3Result(\SQLite3Result $result, array...
FILE: Caster/StubCaster.php
class StubCaster (line 25) | class StubCaster
method castStub (line 27) | public static function castStub(Stub $c, array $a, Stub $stub, bool $i...
method castCutArray (line 48) | public static function castCutArray(CutArrayStub $c, array $a, Stub $s...
method cutInternals (line 53) | public static function cutInternals($obj, array $a, Stub $stub, bool $...
method castEnum (line 64) | public static function castEnum(EnumStub $c, array $a, Stub $stub, boo...
method castScalar (line 87) | public static function castScalar(ScalarStub $scalarStub, array $a, St...
FILE: Caster/SymfonyCaster.php
class SymfonyCaster (line 26) | class SymfonyCaster
method castRequest (line 37) | public static function castRequest(Request $request, array $a, Stub $s...
method castHttpClient (line 52) | public static function castHttpClient($client, array $a, Stub $stub, b...
method castHttpClientResponse (line 62) | public static function castHttpClientResponse($response, array $a, Stu...
method castLazyObjectState (line 74) | public static function castLazyObjectState($state, array $a, Stub $stu...
method castUuid (line 101) | public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool...
method castUlid (line 113) | public static function castUlid(Ulid $ulid, array $a, Stub $stub, bool...
FILE: Caster/TraceStub.php
class TraceStub (line 21) | class TraceStub extends Stub
method __construct (line 23) | public function __construct(
FILE: Caster/UninitializedStub.php
class UninitializedStub (line 19) | class UninitializedStub extends ConstStub
method __construct (line 21) | public function __construct(\ReflectionProperty $property)
FILE: Caster/UuidCaster.php
class UuidCaster (line 22) | final class UuidCaster
method castRamseyUuid (line 24) | public static function castRamseyUuid(UuidInterface $c, array $a, Stub...
FILE: Caster/VirtualStub.php
class VirtualStub (line 14) | class VirtualStub extends ConstStub
method __construct (line 16) | public function __construct(\ReflectionProperty $property)
FILE: Caster/XmlReaderCaster.php
class XmlReaderCaster (line 25) | class XmlReaderCaster
method castXmlReader (line 48) | public static function castXmlReader(\XMLReader $reader, array $a, Stu...
FILE: Caster/XmlResourceCaster.php
class XmlResourceCaster (line 25) | class XmlResourceCaster
method castXml (line 52) | public static function castXml($h, array $a, Stub $stub, bool $isNeste...
FILE: Cloner/AbstractCloner.php
class AbstractCloner (line 22) | abstract class AbstractCloner implements ClonerInterface
method __construct (line 229) | public function __construct(?array $casters = null)
method addCasters (line 244) | public function addCasters(array $casters): void
method addDefaultCasters (line 261) | public static function addDefaultCasters(array $casters): void
method setMaxItems (line 269) | public function setMaxItems(int $maxItems): void
method setMaxString (line 277) | public function setMaxString(int $maxString): void
method setMinDepth (line 286) | public function setMinDepth(int $minDepth): void
method cloneVar (line 296) | public function cloneVar(mixed $var, int $filter = 0): Data
method doClone (line 329) | abstract protected function doClone(mixed $var): array;
method castObject (line 336) | protected function castObject(Stub $stub, bool $isNested): array
method castResource (line 393) | protected function castResource(Stub $stub, bool $isNested): array
FILE: Cloner/ClonerInterface.php
type ClonerInterface (line 17) | interface ClonerInterface
method cloneVar (line 22) | public function cloneVar(mixed $var): Data;
FILE: Cloner/Cursor.php
class Cursor (line 19) | class Cursor
FILE: Cloner/Data.php
class Data (line 20) | class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Str...
method __construct (line 33) | public function __construct(array $data)
method getType (line 38) | public function getType(): ?string
method getValue (line 71) | public function getValue(array|bool $recursive = false): string|int|fl...
method count (line 110) | public function count(): int
method getIterator (line 115) | public function getIterator(): \Traversable
method __get (line 124) | public function __get(string $key): mixed
method __isset (line 135) | public function __isset(string $key): bool
method offsetExists (line 140) | public function offsetExists(mixed $key): bool
method offsetGet (line 145) | public function offsetGet(mixed $key): mixed
method offsetSet (line 150) | public function offsetSet(mixed $key, mixed $value): void
method offsetUnset (line 155) | public function offsetUnset(mixed $key): void
method __toString (line 160) | public function __toString(): string
method withMaxDepth (line 174) | public function withMaxDepth(int $maxDepth): static
method withMaxItemsPerDepth (line 185) | public function withMaxItemsPerDepth(int $maxItemsPerDepth): static
method withRefHandles (line 198) | public function withRefHandles(bool $useRefHandles): static
method withContext (line 206) | public function withContext(array $context): static
method getContext (line 214) | public function getContext(): array
method seek (line 222) | public function seek(string|int $key): ?static
method dump (line 266) | public function dump(DumperInterface $dumper): void
method dumpItem (line 286) | private function dumpItem(DumperInterface $dumper, Cursor $cursor, arr...
method dumpChildren (line 390) | private function dumpChildren(DumperInterface $dumper, Cursor $parentC...
method getStub (line 412) | private function getStub(mixed $item): mixed
FILE: Cloner/DumperInterface.php
type DumperInterface (line 19) | interface DumperInterface
method dumpScalar (line 24) | public function dumpScalar(Cursor $cursor, string $type, string|int|fl...
method dumpString (line 33) | public function dumpString(Cursor $cursor, string $str, bool $bin, int...
method enterHash (line 42) | public function enterHash(Cursor $cursor, int $type, string|int|null $...
method leaveHash (line 52) | public function leaveHash(Cursor $cursor, int $type, string|int|null $...
FILE: Cloner/Stub.php
class Stub (line 19) | class Stub
method __serialize (line 48) | public function __serialize(): array
FILE: Cloner/VarCloner.php
class VarCloner (line 17) | class VarCloner extends AbstractCloner
method doClone (line 21) | protected function doClone(mixed $var): array
FILE: Command/Descriptor/CliDescriptor.php
class CliDescriptor (line 27) | class CliDescriptor implements DumpDescriptorInterface
method __construct (line 31) | public function __construct(
method describe (line 36) | public function describe(OutputInterface $output, Data $data, array $c...
FILE: Command/Descriptor/DumpDescriptorInterface.php
type DumpDescriptorInterface (line 20) | interface DumpDescriptorInterface
method describe (line 22) | public function describe(OutputInterface $output, Data $data, array $c...
FILE: Command/Descriptor/HtmlDescriptor.php
class HtmlDescriptor (line 25) | class HtmlDescriptor implements DumpDescriptorInterface
method __construct (line 29) | public function __construct(
method describe (line 34) | public function describe(OutputInterface $output, Data $data, array $c...
method extractDate (line 94) | private function extractDate(array $context, string $format = 'r'): st...
method renderTags (line 99) | private function renderTags(array $tags): string
FILE: Command/ServerDumpCommand.php
class ServerDumpCommand (line 38) | #[AsCommand(name: 'server:dump', description: 'Start a dump server that ...
method __construct (line 44) | public function __construct(
method configure (line 56) | protected function configure(): void
method execute (line 76) | protected function execute(InputInterface $input, OutputInterface $out...
method complete (line 100) | public function complete(CompletionInput $input, CompletionSuggestions...
method getAvailableFormats (line 107) | private function getAvailableFormats(): array
FILE: Dumper/AbstractDumper.php
class AbstractDumper (line 22) | abstract class AbstractDumper implements DataDumperInterface, DumperInte...
method __construct (line 47) | public function __construct(
method setOutput (line 66) | public function setOutput($output)
method setCharset (line 89) | public function setCharset(string $charset): string
method setIndentPad (line 108) | public function setIndentPad(string $pad): string
method dump (line 123) | public function dump(Data $data, $output = null): ?string
method dumpLine (line 163) | protected function dumpLine(int $depth): void
method echoLine (line 172) | protected function echoLine(string $line, int $depth, string $indentPa...
method utf8Encode (line 182) | protected function utf8Encode(?string $s): ?string
FILE: Dumper/CliDumper.php
class CliDumper (line 23) | class CliDumper extends AbstractDumper
method __construct (line 68) | public function __construct($output = null, ?string $charset = null, i...
method setColors (line 93) | public function setColors(bool $colors): void
method setMaxStringWidth (line 101) | public function setMaxStringWidth(int $maxStringWidth): void
method setStyles (line 111) | public function setStyles(array $styles): void
method setDisplayOptions (line 121) | public function setDisplayOptions(array $displayOptions): void
method dumpScalar (line 126) | public function dumpScalar(Cursor $cursor, string $type, string|int|fl...
method dumpString (line 187) | public function dumpString(Cursor $cursor, string $str, bool $bin, int...
method enterHash (line 276) | public function enterHash(Cursor $cursor, int $type, string|int|null $...
method leaveHash (line 313) | public function leaveHash(Cursor $cursor, int $type, string|int|null $...
method dumpEllipsis (line 329) | protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $c...
method dumpKey (line 345) | protected function dumpKey(Cursor $cursor): void
method style (line 434) | protected function style(string $style, string $value, array $attr = [...
method supportsColors (line 520) | protected function supportsColors(): bool
method dumpLine (line 559) | protected function dumpLine(int $depth, bool $endOfValue = false): void
method endValue (line 567) | protected function endValue(Cursor $cursor): void
method hasColorSupport (line 590) | private function hasColorSupport(mixed $stream): bool
method isWindowsTrueColor (line 639) | private function isWindowsTrueColor(): bool
method getSourceLink (line 659) | private function getSourceLink(string $file, int $line): string|false
FILE: Dumper/ContextProvider/CliContextProvider.php
class CliContextProvider (line 19) | final class CliContextProvider implements ContextProviderInterface
method getContext (line 21) | public function getContext(): ?array
FILE: Dumper/ContextProvider/ContextProviderInterface.php
type ContextProviderInterface (line 19) | interface ContextProviderInterface
method getContext (line 21) | public function getContext(): ?array;
FILE: Dumper/ContextProvider/RequestContextProvider.php
class RequestContextProvider (line 23) | final class RequestContextProvider implements ContextProviderInterface
method __construct (line 27) | public function __construct(
method getContext (line 35) | public function getContext(): ?array
FILE: Dumper/ContextProvider/SourceContextProvider.php
class SourceContextProvider (line 26) | final class SourceContextProvider implements ContextProviderInterface
method __construct (line 28) | public function __construct(
method getContext (line 36) | public function getContext(): ?array
method htmlEncode (line 108) | private function htmlEncode(string $s): string
FILE: Dumper/ContextualizedDumper.php
class ContextualizedDumper (line 20) | class ContextualizedDumper implements DataDumperInterface
method __construct (line 25) | public function __construct(
method dump (line 31) | public function dump(Data $data): ?string
FILE: Dumper/DataDumperInterface.php
type DataDumperInterface (line 21) | interface DataDumperInterface
method dump (line 23) | public function dump(Data $data): ?string;
FILE: Dumper/HtmlDumper.php
class HtmlDumper (line 22) | class HtmlDumper extends CliDumper
method __construct (line 79) | public function __construct($output = null, ?string $charset = null, i...
method setStyles (line 87) | public function setStyles(array $styles): void
method setTheme (line 93) | public function setTheme(string $themeName): void
method setDisplayOptions (line 107) | public function setDisplayOptions(array $displayOptions): void
method setDumpHeader (line 116) | public function setDumpHeader(?string $header): void
method setDumpBoundaries (line 124) | public function setDumpBoundaries(string $prefix, string $suffix): void
method dump (line 130) | public function dump(Data $data, $output = null, array $extraDisplayOp...
method getDumpHeader (line 142) | protected function getDumpHeader(): string
method dumpString (line 770) | public function dumpString(Cursor $cursor, string $str, bool $bin, int...
method enterHash (line 785) | public function enterHash(Cursor $cursor, int $type, string|int|null $...
method leaveHash (line 813) | public function leaveHash(Cursor $cursor, int $type, string|int|null $...
method style (line 822) | protected function style(string $style, string $value, array $attr = [...
method dumpLine (line 936) | protected function dumpLine(int $depth, bool $endOfValue = false): void
method getSourceLink (line 963) | private function getSourceLink(string $file, int $line): string|false
function esc (line 975) | function esc(string $str): string
FILE: Dumper/ServerDumper.php
class ServerDumper (line 23) | class ServerDumper implements DataDumperInterface
method __construct (line 32) | public function __construct(
method getContextProviders (line 40) | public function getContextProviders(): array
method dump (line 45) | public function dump(Data $data): ?string
FILE: Exception/ThrowingCasterException.php
class ThrowingCasterException (line 17) | class ThrowingCasterException extends \Exception
method __construct (line 22) | public function __construct(\Throwable $prev)
FILE: Resources/functions/dump.php
function dump (line 20) | function dump(mixed ...$vars): mixed
function dd (line 46) | function dd(mixed ...$vars): never
FILE: Server/Connection.php
class Connection (line 22) | class Connection
method __construct (line 35) | public function __construct(
method getContextProviders (line 46) | public function getContextProviders(): array
method write (line 51) | public function write(Data $data): bool
method createSocket (line 88) | private function createSocket()
FILE: Server/DumpServer.php
class DumpServer (line 25) | class DumpServer
method __construct (line 34) | public function __construct(
method start (line 45) | public function start(): void
method listen (line 52) | public function listen(callable $callback): void
method getHost (line 82) | public function getHost(): string
method getMessages (line 87) | private function getMessages(): iterable
FILE: Test/VarDumperTestTrait.php
type VarDumperTestTrait (line 21) | trait VarDumperTestTrait
method setUpVarDumper (line 34) | protected function setUpVarDumper(array $casters, ?int $flags = null):...
method tearDownVarDumper (line 43) | #[After]
method assertDumpEquals (line 50) | public function assertDumpEquals(mixed $expected, mixed $data, int $fi...
method assertDumpMatchesFormat (line 55) | public function assertDumpMatchesFormat(mixed $expected, mixed $data, ...
method getDump (line 60) | protected function getDump(mixed $data, string|int|null $key = null, i...
method prepareExpectation (line 81) | private function prepareExpectation(mixed $expected, int $filter): string
FILE: Tests/Caster/AddressInfoCasterTest.php
class AddressInfoCasterTest (line 18) | #[RequiresPhpExtension('sockets')]
method testCaster (line 23) | public function testCaster()
FILE: Tests/Caster/CasterTest.php
class CasterTest (line 22) | class CasterTest extends TestCase
method testFilter (line 36) | #[DataProvider('provideFilter')]
method provideFilter (line 48) | public static function provideFilter()
method testAnonymousClass (line 153) | public function testAnonymousClass()
method testTypeErrorInDebugInfo (line 178) | public function testTypeErrorInDebugInfo()
method testClassHierarchy (line 188) | public function testClassHierarchy()
class A (line 205) | class A
class B (line 212) | class B extends A
FILE: Tests/Caster/CurlCasterTest.php
class CurlCasterTest (line 18) | #[RequiresPhpExtension('curl')]
method testCastCurl (line 23) | public function testCastCurl()
FILE: Tests/Caster/DOMCasterTest.php
class DOMCasterTest (line 17) | class DOMCasterTest extends TestCase
method testCastImplementation (line 21) | public function testCastImplementation()
method testCastModernImplementation (line 35) | public function testCastModernImplementation()
method testCastNode (line 49) | public function testCastNode()
method testCastModernNode (line 64) | public function testCastModernNode()
method testCastDocument (line 78) | public function testCastDocument()
method testCastXMLDocument (line 97) | public function testCastXMLDocument()
method testCastHTMLDocument (line 115) | public function testCastHTMLDocument()
method testCastText (line 128) | public function testCastText()
method testCastModernText (line 141) | public function testCastModernText()
method testCastAttr (line 153) | public function testCastAttr()
method testCastModernAttr (line 166) | public function testCastModernAttr()
method testCastElement (line 179) | public function testCastElement()
method testCastModernElement (line 192) | public function testCastModernElement()
method testCastDocumentType (line 205) | public function testCastDocumentType()
method testCastModernDocumentType (line 221) | public function testCastModernDocumentType()
method testCastProcessingInstruction (line 235) | public function testCastProcessingInstruction()
method testCastModernProcessingInstruction (line 248) | public function testCastModernProcessingInstruction()
method testCastXPath (line 261) | public function testCastXPath()
method testCastModernXPath (line 275) | public function testCastModernXPath()
FILE: Tests/Caster/DateCasterTest.php
class DateCasterTest (line 25) | class DateCasterTest extends TestCase
method setUp (line 31) | protected function setUp(): void
method tearDown (line 36) | protected function tearDown(): void
method testDumpDateTime (line 41) | #[DataProvider('provideDateTimes')]
method testDumpDateTimeImmutable (line 55) | #[DataProvider('provideDateTimes')]
method testCastDateTime (line 69) | #[DataProvider('provideDateTimes')]
method provideDateTimes (line 100) | public static function provideDateTimes()
method testCastDateTimeNoTimezone (line 116) | #[DataProvider('provideNoTimezoneDateTimes')]
method provideNoTimezoneDateTimes (line 149) | public static function provideNoTimezoneDateTimes()
method testCastDateTimeWithAdditionalChildProperty (line 162) | public function testCastDateTimeWithAdditionalChildProperty()
method testDumpInterval (line 196) | #[DataProvider('provideIntervals')]
method testDumpIntervalExcludingVerbosity (line 210) | #[DataProvider('provideIntervals')]
method testCastInterval (line 224) | #[DataProvider('provideIntervals')]
method provideIntervals (line 260) | public static function provideIntervals()
method testDumpTimeZone (line 293) | #[DataProvider('provideTimeZones')]
method testDumpTimeZoneExcludingVerbosity (line 307) | #[DataProvider('provideTimeZones')]
method testCastTimeZone (line 321) | #[DataProvider('provideTimeZones')]
method provideTimeZones (line 353) | public static function provideTimeZones()
method testDumpPeriod (line 380) | #[DataProvider('providePeriods')]
method testCastPeriod (line 394) | #[DataProvider('providePeriods')]
method providePeriods (line 426) | public static function providePeriods()
method createInterval (line 454) | private function createInterval($intervalSpec, $ms, $invert)
class NoTimezoneDate (line 464) | class NoTimezoneDate extends \DateTime
method getTimezone (line 466) | public function getTimezone(): \DateTimeZone|false
FILE: Tests/Caster/DoctrineCasterTest.php
class DoctrineCasterTest (line 22) | #[RequiresMethod(ArrayCollection::class, '__construct')]
method testCastPersistentCollection (line 27) | public function testCastPersistentCollection()
FILE: Tests/Caster/ExceptionCasterTest.php
class ExceptionCasterTest (line 26) | class ExceptionCasterTest extends TestCase
method getTestException (line 30) | private function getTestException($msg, &$ref = null)
method getTestError (line 35) | private function getTestError($msg): \Error
method getTestErrorException (line 40) | private function getTestErrorException($msg): \ErrorException
method getTestSilencedErrorContext (line 45) | private function getTestSilencedErrorContext(): SilencedErrorContext
method tearDown (line 50) | protected function tearDown(): void
method testDefaultSettings (line 56) | public function testDefaultSettings()
method testDefaultSettingsOnError (line 82) | public function testDefaultSettingsOnError()
method testDefaultSettingsOnErrorException (line 106) | public function testDefaultSettingsOnErrorException()
method testCastSilencedErrorContext (line 131) | #[RequiresMethod(SilencedErrorContext::class, '__construct')]
method testSeek (line 153) | public function testSeek()
method testNoArgs (line 172) | public function testNoArgs()
method testNoSrcContext (line 197) | public function testNoSrcContext()
method testShouldReturnTraceForConcreteTwigWithError (line 217) | public function testShouldReturnTraceForConcreteTwigWithError()
method testHtmlDump (line 241) | public function testHtmlDump()
method testFrameWithTwig (line 276) | public function testFrameWithTwig()
method testExcludeVerbosity (line 325) | public function testExcludeVerbosity()
method testAnonymous (line 341) | public function testAnonymous()
method testFlattenException (line 358) | #[RequiresMethod(FlattenException::class, 'create')]
FILE: Tests/Caster/FFICasterTest.php
class FFICasterTest (line 23) | #[RequiresPhpExtension('ffi')]
method setUp (line 33) | protected function setUp(): void
method testCastAnonymousStruct (line 43) | public function testCastAnonymousStruct()
method testCastNamedStruct (line 54) | public function testCastNamedStruct()
method testCastAnonymousUnion (line 65) | public function testCastAnonymousUnion()
method testCastNamedUnion (line 77) | public function testCastNamedUnion()
method testCastAnonymousEnum (line 89) | public function testCastAnonymousEnum()
method testCastNamedEnum (line 100) | public function testCastNamedEnum()
method scalarsDataProvider (line 111) | public static function scalarsDataProvider(): array
method testCastScalar (line 130) | #[DataProvider('scalarsDataProvider')]
method testCastVoidFunction (line 142) | public function testCastVoidFunction()
method testCastIntFunction (line 155) | public function testCastIntFunction()
method testCastFunctionWithArguments (line 168) | public function testCastFunctionWithArguments()
method testCastNonCuttedPointerToChar (line 181) | public function testCastNonCuttedPointerToChar()
method testCastCuttedPointerToChar (line 198) | public function testCastCuttedPointerToChar()
method testCastNonTrailingCharPointer (line 230) | public function testCastNonTrailingCharPointer()
method testCastUnionWithDirectReferencedFields (line 251) | public function testCastUnionWithDirectReferencedFields()
method testCastUnionWithPointerReferencedFields (line 271) | public function testCastUnionWithPointerReferencedFields()
method testCastUnionWithMixedFields (line 295) | public function testCastUnionWithMixedFields()
method testCastPointerToEmptyScalars (line 323) | public function testCastPointerToEmptyScalars()
method testCastPointerToNonEmptyScalars (line 353) | public function testCastPointerToNonEmptyScalars()
method testCastPointerToStruct (line 417) | public function testCastPointerToStruct()
method testCastComplexType (line 457) | public function testCastComplexType()
FILE: Tests/Caster/FiberCasterTest.php
class FiberCasterTest (line 17) | class FiberCasterTest extends TestCase
method testCastFiberNotStarted (line 21) | public function testCastFiberNotStarted()
method testCastFiberTerminated (line 34) | public function testCastFiberTerminated()
method testCastFiberSuspended (line 48) | public function testCastFiberSuspended()
method testCastFiberRunning (line 62) | public function testCastFiberRunning()
FILE: Tests/Caster/GmpCasterTest.php
class GmpCasterTest (line 20) | class GmpCasterTest extends TestCase
method testCastGmp (line 24) | #[RequiresPhpExtension('gmp')]
FILE: Tests/Caster/IntlCasterTest.php
class IntlCasterTest (line 18) | #[RequiresPhpExtension('intl')]
method testMessageFormatter (line 23) | public function testMessageFormatter()
method testCastNumberFormatter (line 36) | public function testCastNumberFormatter()
method testCastIntlTimeZoneWithDST (line 153) | public function testCastIntlTimeZoneWithDST()
method testCastIntlTimeZoneWithoutDST (line 173) | public function testCastIntlTimeZoneWithoutDST()
method testCastIntlCalendar (line 191) | public function testCastIntlCalendar()
method testCastDateFormatter (line 231) | public function testCastDateFormatter()
method normalizeNarrowNoBreakSpaceCharacter (line 297) | private function normalizeNarrowNoBreakSpaceCharacter(string $input): ...
FILE: Tests/Caster/MemcachedCasterTest.php
class MemcachedCasterTest (line 20) | class MemcachedCasterTest extends TestCase
method testCastMemcachedWithDefaultOptions (line 24) | public function testCastMemcachedWithDefaultOptions()
method testCastMemcachedWithCustomOptions (line 54) | public function testCastMemcachedWithCustomOptions()
FILE: Tests/Caster/MysqliCasterTest.php
class MysqliCasterTest (line 19) | #[RequiresPhpExtension('mysqli')]
method testNotConnected (line 25) | public function testNotConnected()
FILE: Tests/Caster/OpenSSLCasterTest.php
class OpenSSLCasterTest (line 18) | #[RequiresPhpExtension('openssl')]
method testAsymmetricKey (line 23) | public function testAsymmetricKey()
method testOpensslCsr (line 53) | public function testOpensslCsr()
FILE: Tests/Caster/PdoCasterTest.php
class PdoCasterTest (line 25) | class PdoCasterTest extends TestCase
method testCastPdo (line 29) | #[RequiresPhpExtension('pdo_sqlite')]
FILE: Tests/Caster/RdKafkaCasterTest.php
class RdKafkaCasterTest (line 23) | #[RequiresPhpExtension('rdkafka')]
method setUp (line 35) | protected function setUp(): void
method testDumpConf (line 43) | public function testDumpConf()
method testDumpProducer (line 70) | public function testDumpProducer()
method testDumpTopicConf (line 109) | public function testDumpTopicConf()
method testDumpKafkaConsumer (line 133) | public function testDumpKafkaConsumer()
method testDumpProducerTopic (line 179) | public function testDumpProducerTopic()
method testDumpMessage (line 196) | public function testDumpMessage()
FILE: Tests/Caster/RedisCasterTest.php
class RedisCasterTest (line 24) | #[Group('integration')]
method testNotConnected (line 29) | #[RequiresPhpExtension('redis')]
method testConnected (line 43) | #[TestWith([\Redis::class])]
FILE: Tests/Caster/ReflectionCasterTest.php
class ReflectionCasterTest (line 30) | class ReflectionCasterTest extends TestCase
method testReflectionCaster (line 34) | public function testReflectionCaster()
method testClosureCaster (line 86) | public function testClosureCaster()
method testFromCallableClosureCaster (line 106) | public function testFromCallableClosureCaster()
method testClosureCasterExcludingVerbosity (line 132) | public function testClosureCasterExcludingVerbosity()
method testReflectionParameter (line 141) | public function testReflectionParameter()
method testReflectionParameterScalar (line 158) | public function testReflectionParameterScalar()
method testReflectionParameterMixed (line 175) | public function testReflectionParameterMixed()
method testReflectionParameterUnion (line 193) | public function testReflectionParameterUnion()
method testReflectionParameterNullableUnion (line 210) | public function testReflectionParameterNullableUnion()
method testReflectionParameterIntersection (line 228) | public function testReflectionParameterIntersection()
method testReflectionPropertyScalar (line 245) | public function testReflectionPropertyScalar()
method testReflectionNamedType (line 260) | public function testReflectionNamedType()
method testReflectionUnionType (line 275) | public function testReflectionUnionType()
method testReflectionIntersectionType (line 300) | public function testReflectionIntersectionType()
method testReflectionUnionTypeWithIntersection (line 325) | public function testReflectionUnionTypeWithIntersection()
method testExtendsReflectionType (line 360) | public function testExtendsReflectionType()
method testReturnType (line 373) | public function testReturnType()
method testMixedReturnType (line 393) | public function testMixedReturnType()
method testNullReturnType (line 413) | public function testNullReturnType()
method testUnionReturnType (line 430) | public function testUnionReturnType()
method testNullableUnionReturnType (line 450) | public function testNullableUnionReturnType()
method testGenerator (line 470) | public function testGenerator()
method testNewInInitializer (line 548) | public function testNewInInitializer()
method testReflectionClassWithAttribute (line 567) | public function testReflectionClassWithAttribute()
method testReflectionMethodWithAttribute (line 587) | public function testReflectionMethodWithAttribute()
method testReflectionPropertyWithAttribute (line 610) | public function testReflectionPropertyWithAttribute()
method testReflectionClassConstantWithAttribute (line 633) | public function testReflectionClassConstantWithAttribute()
method testReflectionParameterWithAttribute (line 663) | public function testReflectionParameterWithAttribute()
method stub (line 686) | public static function stub(): void
function reflectionParameterFixture (line 691) | function reflectionParameterFixture(?NotLoadableClass $arg1, $arg2)
FILE: Tests/Caster/ResourceCasterTest.php
class ResourceCasterTest (line 18) | class ResourceCasterTest extends TestCase
method testCastDba (line 22) | #[RequiresPhpExtension('dba')]
method testCastDbaOnBuggyPhp84 (line 37) | #[RequiresPhpExtension('dba')]
FILE: Tests/Caster/SocketCasterTest.php
class SocketCasterTest (line 18) | #[RequiresPhpExtension('sockets')]
method testCastSocket (line 23) | public function testCastSocket()
method testCastSocketIpV6 (line 40) | public function testCastSocketIpV6()
method testCastUnixSocket (line 58) | public function testCastUnixSocket()
FILE: Tests/Caster/SplCasterTest.php
class SplCasterTest (line 21) | class SplCasterTest extends TestCase
method getCastFileInfoTests (line 25) | public static function getCastFileInfoTests()
method testCastFileInfo (line 68) | #[DataProvider('getCastFileInfoTests')]
method testCastFileObject (line 74) | public function testCastFileObject()
method testCastSplDoublyLinkedList (line 123) | #[DataProvider('provideCastSplDoublyLinkedList')]
method provideCastSplDoublyLinkedList (line 137) | public static function provideCastSplDoublyLinkedList()
method testCastObjectStorageIsntModified (line 147) | public function testCastObjectStorageIsntModified()
method testCastObjectStorageDumpsInfo (line 158) | public function testCastObjectStorageDumpsInfo()
method testCastArrayObject (line 166) | public function testCastArrayObject()
method testArrayIterator (line 187) | public function testArrayIterator()
method testBadSplFileInfo (line 204) | public function testBadSplFileInfo()
method testWeakMap (line 216) | public function testWeakMap()
class MyArrayIterator (line 237) | class MyArrayIterator extends \ArrayIterator
class BadSplFileInfo (line 242) | class BadSplFileInfo extends \SplFileInfo
method __construct (line 244) | public function __construct()
FILE: Tests/Caster/SqliteCasterTest.php
class SqliteCasterTest (line 18) | #[RequiresPhpExtension('sqlite3')]
method testSqlite3Result (line 23) | public function testSqlite3Result()
FILE: Tests/Caster/StubCasterTest.php
class StubCasterTest (line 26) | class StubCasterTest extends TestCase
method testArgsStubWithDefaults (line 30) | public function testArgsStubWithDefaults($foo = 234, $bar = 456)
method testArgsStubWithExtraArgs (line 45) | public function testArgsStubWithExtraArgs($foo = 234)
method testArgsStubNoParamWithExtraArgs (line 63) | public function testArgsStubNoParamWithExtraArgs()
method testArgsStubWithClosure (line 78) | public function testArgsStubWithClosure()
method testEmptyStub (line 93) | public function testEmptyStub()
method testVirtualPropertyStub (line 106) | public function testVirtualPropertyStub()
method testVirtualPropertyWithoutTypeStub (line 120) | public function testVirtualPropertyWithoutTypeStub()
method testLinkStub (line 134) | public function testLinkStub()
method testLinkStubWithNoFileLink (line 155) | public function testLinkStubWithNoFileLink()
method testClassStub (line 176) | public function testClassStub()
method testClassStubWithNotExistingClass (line 196) | public function testClassStubWithNotExistingClass()
method testClassStubWithNotExistingMethod (line 217) | public function testClassStubWithNotExistingMethod()
method testClassStubWithAnonymousClass (line 237) | public function testClassStubWithAnonymousClass()
FILE: Tests/Caster/SymfonyCasterTest.php
class SymfonyCasterTest (line 20) | final class SymfonyCasterTest extends TestCase
method testCastUuid (line 24) | public function testCastUuid()
method testCastUlid (line 49) | public function testCastUlid()
FILE: Tests/Caster/XmlReaderCasterTest.php
class XmlReaderCasterTest (line 20) | class XmlReaderCasterTest extends TestCase
method setUp (line 26) | protected function setUp(): void
method tearDown (line 32) | protected function tearDown(): void
method testParserProperty (line 37) | public function testParserProperty()
method provideNodes (line 56) | public static function provideNodes()
method testWithUninitializedXMLReader (line 238) | public function testWithUninitializedXMLReader()
FILE: Tests/Cloner/DataTest.php
class DataTest (line 20) | class DataTest extends TestCase
method testBasicData (line 22) | public function testBasicData()
method testObject (line 48) | public function testObject()
method testArray (line 63) | public function testArray()
method testStub (line 84) | public function testStub()
method testHardRefs (line 94) | public function testHardRefs()
method cloneVar (line 109) | private function cloneVar($value)
FILE: Tests/Cloner/StubTest.php
class StubTest (line 17) | final class StubTest extends TestCase
method testUnserializeNullValue (line 19) | public function testUnserializeNullValue()
method testUnserializeNullInTypedProperty (line 29) | public function testUnserializeNullInTypedProperty()
method testUninitializedStubPropertiesAreLeftUninitialized (line 39) | public function testUninitializedStubPropertiesAreLeftUninitialized()
class MyStub (line 50) | final class MyStub extends Stub
FILE: Tests/Cloner/VarClonerTest.php
class VarClonerTest (line 26) | class VarClonerTest extends TestCase
method testAddCaster (line 28) | public function testAddCaster()
method testMaxIntBoundary (line 86) | public function testMaxIntBoundary()
method testClone (line 129) | public function testClone()
method testLimits (line 221) | public function testLimits()
method testJsonCast (line 393) | public function testJsonCast()
method testCaster (line 461) | public function testCaster()
method testPhp74 (line 521) | public function testPhp74()
method testPhp81Enums (line 634) | public function testPhp81Enums()
FILE: Tests/Command/Descriptor/CliDescriptorTest.php
class CliDescriptorTest (line 21) | class CliDescriptorTest extends TestCase
method setUpBeforeClass (line 26) | public static function setUpBeforeClass(): void
method tearDownAfterClass (line 35) | public static function tearDownAfterClass(): void
method testDescribe (line 41) | #[DataProvider('provideContext')]
method provideContext (line 53) | public static function provideContext()
FILE: Tests/Command/Descriptor/HtmlDescriptorTest.php
class HtmlDescriptorTest (line 21) | class HtmlDescriptorTest extends TestCase
method setUpBeforeClass (line 25) | public static function setUpBeforeClass(): void
method tearDownAfterClass (line 31) | public static function tearDownAfterClass(): void
method testItOutputsStylesAndScriptsOnFirstDescribeCall (line 36) | public function testItOutputsStylesAndScriptsOnFirstDescribeCall()
method testDescribe (line 52) | #[DataProvider('provideContext')]
method provideContext (line 65) | public static function provideContext()
FILE: Tests/Command/ServerDumpCommandTest.php
class ServerDumpCommandTest (line 20) | class ServerDumpCommandTest extends TestCase
method testComplete (line 22) | #[DataProvider('provideCompletionSuggestions')]
method provideCompletionSuggestions (line 30) | public static function provideCompletionSuggestions()
method createCommand (line 38) | private function createCommand(): ServerDumpCommand
FILE: Tests/Dumper/CliDumperTest.php
class CliDumperTest (line 31) | class CliDumperTest extends TestCase
method testGet (line 35) | public function testGet()
method testDumpWithCommaFlag (line 120) | #[DataProvider('provideDumpWithCommaFlagTests')]
method testDumpWithCommaFlagsAndExceptionCodeExcerpt (line 138) | public function testDumpWithCommaFlagsAndExceptionCodeExcerpt()
method provideDumpWithCommaFlagTests (line 170) | public static function provideDumpWithCommaFlagTests()
method testJsonCast (line 211) | public function testJsonCast()
method testObjectCast (line 232) | public function testObjectCast()
method testClosedResource (line 247) | public function testClosedResource()
method testFlags (line 271) | public function testFlags()
method testVirtualProperties (line 302) | public function testVirtualProperties()
method testThrowingCaster (line 316) | public function testThrowingCaster()
method testRefsInProperties (line 378) | public function testRefsInProperties()
method testIncompleteClass (line 402) | public function testIncompleteClass()
method provideDumpArrayWithColor (line 416) | public static function provideDumpArrayWithColor()
method testDumpArrayWithColor (line 445) | #[DataProvider('provideDumpArrayWithColor')]
method testCollapse (line 465) | public function testCollapse()
method testFileLinkFormat (line 506) | public function testFileLinkFormat()
FILE: Tests/Dumper/ContextProvider/RequestContextProviderTest.php
class RequestContextProviderTest (line 21) | #[RequiresMethod(RequestStack::class, '__construct')]
method testGetContextOnNullRequest (line 24) | public function testGetContextOnNullRequest()
method testGetContextOnRequest (line 32) | public function testGetContextOnRequest()
FILE: Tests/Dumper/ContextualizedDumperTest.php
class ContextualizedDumperTest (line 24) | #[BackupGlobals(true)]
method testContextualizedCliDumper (line 27) | public function testContextualizedCliDumper()
FILE: Tests/Dumper/FunctionsTest.php
class FunctionsTest (line 19) | class FunctionsTest extends TestCase
method testDumpWithoutArg (line 21) | public function testDumpWithoutArg()
method testDumpReturnsFirstArg (line 32) | public function testDumpReturnsFirstArg()
method testDumpReturnsFirstNamedArgWithoutSectionName (line 45) | public function testDumpReturnsFirstNamedArgWithoutSectionName()
method testDumpReturnsAllArgsInArray (line 58) | public function testDumpReturnsAllArgsInArray()
method testDumpReturnsAllNamedArgsInArray (line 73) | public function testDumpReturnsAllNamedArgsInArray()
method setupVarDumper (line 88) | protected function setupVarDumper()
FILE: Tests/Dumper/HtmlDumperTest.php
class HtmlDumperTest (line 24) | class HtmlDumperTest extends TestCase
method testGet (line 26) | public function testGet()
method testVirtualProperties (line 121) | public function testVirtualProperties()
method testCharset (line 144) | public function testCharset()
method testAppend (line 166) | public function testAppend()
method testDumpString (line 191) | #[DataProvider('varToDumpProvider')]
method varToDumpProvider (line 204) | public static function varToDumpProvider()
FILE: Tests/Dumper/ServerDumperTest.php
class ServerDumperTest (line 22) | class ServerDumperTest extends TestCase
method testDumpForwardsToWrappedDumperWhenServerIsUnavailable (line 26) | public function testDumpForwardsToWrappedDumperWhenServerIsUnavailable()
method testDump (line 40) | public function testDump()
method getServerProcess (line 90) | private function getServerProcess(): Process
FILE: Tests/Fixtures/DateTimeChild.php
class DateTimeChild (line 5) | class DateTimeChild extends \DateTimeImmutable
FILE: Tests/Fixtures/ExtendsReflectionTypeFixture.php
class ExtendsReflectionTypeFixture (line 5) | class ExtendsReflectionTypeFixture extends \ReflectionType
method allowsNull (line 7) | public function allowsNull(): bool
method isBuiltin (line 12) | public function isBuiltin(): bool
method __toString (line 17) | public function __toString(): string
FILE: Tests/Fixtures/FooInterface.php
type FooInterface (line 5) | interface FooInterface
method foo (line 10) | public function foo(?\stdClass $a, ?\stdClass $b = null);
FILE: Tests/Fixtures/GeneratorDemo.php
class GeneratorDemo (line 5) | class GeneratorDemo
method foo (line 7) | public static function foo()
method baz (line 12) | public function baz()
function bar (line 18) | function bar()
FILE: Tests/Fixtures/LotsOfAttributes.php
class LotsOfAttributes (line 14) | #[MyAttribute]
method someMethod (line 23) | #[MyAttribute('two')]
FILE: Tests/Fixtures/MyAttribute.php
class MyAttribute (line 14) | #[\Attribute]
method __construct (line 17) | public function __construct(
method getFoo (line 23) | public function getFoo(): string
method getExtra (line 28) | public function getExtra(): ?string
FILE: Tests/Fixtures/NotLoadableClass.php
class NotLoadableClass (line 5) | class NotLoadableClass extends NotLoadableClass
FILE: Tests/Fixtures/Php74.php
class Php74 (line 5) | class Php74
method __construct (line 11) | public function __construct()
FILE: Tests/Fixtures/Php81Enums.php
class Php81Enums (line 5) | class Php81Enums
method __construct (line 10) | public function __construct()
FILE: Tests/Fixtures/Php82NullStandaloneReturnType.php
class Php82NullStandaloneReturnType (line 14) | class Php82NullStandaloneReturnType
method foo (line 16) | public function foo(null $bar): null
FILE: Tests/Fixtures/ReflectionIntersectionTypeFixture.php
class ReflectionIntersectionTypeFixture (line 5) | class ReflectionIntersectionTypeFixture
FILE: Tests/Fixtures/ReflectionNamedTypeFixture.php
class ReflectionNamedTypeFixture (line 5) | class ReflectionNamedTypeFixture
FILE: Tests/Fixtures/ReflectionUnionTypeFixture.php
class ReflectionUnionTypeFixture (line 5) | class ReflectionUnionTypeFixture
FILE: Tests/Fixtures/ReflectionUnionTypeWithIntersectionFixture.php
class ReflectionUnionTypeWithIntersectionFixture (line 5) | class ReflectionUnionTypeWithIntersectionFixture
FILE: Tests/Fixtures/Twig.php
class AbstractTwigTemplate (line 3) | abstract class AbstractTwigTemplate extends Twig\Template
method createError (line 5) | private function createError()
method provideError (line 10) | public function provideError()
class __TwigTemplate_VarDumperFixture_u75a09 (line 17) | class __TwigTemplate_VarDumperFixture_u75a09 extends AbstractTwigTemplate
method __construct (line 21) | public function __construct(?Twig\Environment $env = null, $path = null)
method doDisplay (line 31) | protected function doDisplay(array $context, array $blocks = []): array
method getTemplateName (line 37) | public function getTemplateName(): string
method getDebugInfo (line 42) | public function getDebugInfo(): array
method getSourceContext (line 47) | public function getSourceContext(): Twig\Source
FILE: Tests/Fixtures/VirtualProperty.php
class VirtualProperty (line 5) | class VirtualProperty
FILE: Tests/Fixtures/dumb-var.php
class DumbFoo (line 15) | #[\AllowDynamicProperties]
FILE: Tests/Server/ConnectionTest.php
class ConnectionTest (line 21) | class ConnectionTest extends TestCase
method testDump (line 25) | public function testDump()
method testNoServer (line 73) | public function testNoServer()
method getServerProcess (line 83) | private function getServerProcess(): Process
FILE: Tests/Test/VarDumperTestTraitTest.php
class VarDumperTestTraitTest (line 19) | class VarDumperTestTraitTest extends TestCase
method testItComparesLargeData (line 23) | public function testItComparesLargeData()
method testAllowsNonScalarExpectation (line 44) | public function testAllowsNonScalarExpectation()
method testItCanBeConfigured (line 49) | public function testItCanBeConfigured()
FILE: VarDumper.php
class VarDumper (line 34) | class VarDumper
method dump (line 41) | public static function dump(mixed $var, ?string $label = null): mixed
method setHandler (line 50) | public static function setHandler(?callable $callable): ?callable
method register (line 64) | private static function register(): void
method selectDumperForAccept (line 95) | private static function selectDumperForAccept(?string $serverHost): Da...
method getDefaultContextProviders (line 113) | private static function getDefaultContextProviders(): array
Condensed preview — 162 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (608K chars).
[
{
"path": ".gitattributes",
"chars": 74,
"preview": "/Tests export-ignore\n/phpunit.xml.dist export-ignore\n/.git* export-ignore\n"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 278,
"preview": "Please do not submit any Pull Requests here. They will be closed.\n---\n\nPlease submit your PR here instead:\nhttps://githu"
},
{
"path": ".github/workflows/close-pull-request.yml",
"chars": 544,
"preview": "name: Close Pull Request\n\non:\n pull_request_target:\n types: [opened]\n\njobs:\n run:\n runs-on: ubuntu-latest\n st"
},
{
"path": ".gitignore",
"chars": 34,
"preview": "composer.lock\nphpunit.xml\nvendor/\n"
},
{
"path": "CHANGELOG.md",
"chars": 3371,
"preview": "CHANGELOG\n=========\n\n7.4\n---\n\n * Add support for adding more default casters to `AbstractCloner::addDefaultCasters()`\n *"
},
{
"path": "Caster/AddressInfoCaster.php",
"chars": 2242,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/AmqpCaster.php",
"chars": 6744,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ArgsStub.php",
"chars": 2280,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/Caster.php",
"chars": 6985,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ClassStub.php",
"chars": 3824,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ConstStub.php",
"chars": 1168,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/CurlCaster.php",
"chars": 668,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/CutArrayStub.php",
"chars": 702,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/CutStub.php",
"chars": 1939,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/DOMCaster.php",
"chars": 7159,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/DateCaster.php",
"chars": 4928,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/DoctrineCaster.php",
"chars": 1709,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/DsCaster.php",
"chars": 1588,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/DsPairStub.php",
"chars": 625,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/EnumStub.php",
"chars": 596,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ExceptionCaster.php",
"chars": 16462,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/FFICaster.php",
"chars": 5669,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/FiberCaster.php",
"chars": 1068,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/FrameStub.php",
"chars": 659,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/GdCaster.php",
"chars": 694,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/GmpCaster.php",
"chars": 765,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ImagineCaster.php",
"chars": 964,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ImgStub.php",
"chars": 636,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/IntlCaster.php",
"chars": 8982,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/LinkStub.php",
"chars": 3371,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/MemcachedCaster.php",
"chars": 2308,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/MysqliCaster.php",
"chars": 691,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/OpenSSLCaster.php",
"chars": 2553,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/PdoCaster.php",
"chars": 3585,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/PgSqlCaster.php",
"chars": 5535,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ProxyManagerCaster.php",
"chars": 744,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/RdKafkaCaster.php",
"chars": 4745,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/RedisCaster.php",
"chars": 5491,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ReflectionCaster.php",
"chars": 15041,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ResourceCaster.php",
"chars": 1473,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/ScalarStub.php",
"chars": 554,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/SocketCaster.php",
"chars": 1751,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/SplCaster.php",
"chars": 8032,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/SqliteCaster.php",
"chars": 770,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/StubCaster.php",
"chars": 2400,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/SymfonyCaster.php",
"chars": 3742,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/TraceStub.php",
"chars": 759,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/UninitializedStub.php",
"chars": 615,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/UuidCaster.php",
"chars": 683,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/VirtualStub.php",
"chars": 548,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/XmlReaderCaster.php",
"chars": 3400,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Caster/XmlResourceCaster.php",
"chars": 2568,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/AbstractCloner.php",
"chars": 22219,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/ClonerInterface.php",
"chars": 459,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/Cursor.php",
"chars": 1173,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/Data.php",
"chars": 13658,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/DumperInterface.php",
"chars": 1808,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/Stub.php",
"chars": 2189,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Cloner/VarCloner.php",
"chars": 9821,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Command/Descriptor/CliDescriptor.php",
"chars": 2618,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Command/Descriptor/DumpDescriptorInterface.php",
"chars": 610,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Command/Descriptor/HtmlDescriptor.php",
"chars": 3962,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Command/ServerDumpCommand.php",
"chars": 3939,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/AbstractDumper.php",
"chars": 7123,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/CliDumper.php",
"chars": 23765,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ContextProvider/CliContextProvider.php",
"chars": 810,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ContextProvider/ContextProviderInterface.php",
"chars": 537,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ContextProvider/RequestContextProvider.php",
"chars": 1479,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ContextProvider/SourceContextProvider.php",
"chars": 4798,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ContextualizedDumper.php",
"chars": 1075,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/DataDumperInterface.php",
"chars": 514,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/HtmlDumper.php",
"chars": 41074,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Dumper/ServerDumper.php",
"chars": 1578,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Exception/ThrowingCasterException.php",
"chars": 650,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "LICENSE",
"chars": 1068,
"preview": "Copyright (c) 2014-present Fabien Potencier\n\nPermission is hereby granted, free of charge, to any person obtaining a cop"
},
{
"path": "README.md",
"chars": 607,
"preview": "VarDumper Component\n===================\n\nThe VarDumper component provides mechanisms for walking through any arbitrary\nP"
},
{
"path": "Resources/bin/var-dump-server",
"chars": 2149,
"preview": "#!/usr/bin/env php\n<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com"
},
{
"path": "Resources/css/htmlDescriptor.css",
"chars": 3010,
"preview": "body {\n display: flex;\n flex-direction: column-reverse;\n justify-content: flex-end;\n max-width: 1140px;\n "
},
{
"path": "Resources/functions/dump.php",
"chars": 1628,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Resources/js/htmlDescriptor.js",
"chars": 354,
"preview": "document.addEventListener('DOMContentLoaded', function() {\n let prev = null;\n Array.from(document.getElementsByTagName"
},
{
"path": "Server/Connection.php",
"chars": 2604,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Server/DumpServer.php",
"chars": 3087,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Test/VarDumperTestTrait.php",
"chars": 2747,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/AddressInfoCasterTest.php",
"chars": 831,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/CasterTest.php",
"chars": 5796,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/CurlCasterTest.php",
"chars": 1019,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/DOMCasterTest.php",
"chars": 6988,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/DateCasterTest.php",
"chars": 17201,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/DoctrineCasterTest.php",
"chars": 1968,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/ExceptionCasterTest.php",
"chars": 13001,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/FFICasterTest.php",
"chars": 14969,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/FiberCasterTest.php",
"chars": 1693,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/GmpCasterTest.php",
"chars": 1421,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/IntlCasterTest.php",
"chars": 15211,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/MemcachedCasterTest.php",
"chars": 2638,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/MysqliCasterTest.php",
"chars": 912,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/OpenSSLCasterTest.php",
"chars": 2414,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/PdoCasterTest.php",
"chars": 2183,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/RdKafkaCasterTest.php",
"chars": 6516,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/RedisCasterTest.php",
"chars": 2125,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/ReflectionCasterTest.php",
"chars": 21453,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/ResourceCasterTest.php",
"chars": 1359,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/SocketCasterTest.php",
"chars": 1947,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/SplCasterTest.php",
"chars": 6998,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/SqliteCasterTest.php",
"chars": 1154,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/StubCasterTest.php",
"chars": 8873,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/SymfonyCasterTest.php",
"chars": 1934,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Caster/XmlReaderCasterTest.php",
"chars": 6791,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Cloner/DataTest.php",
"chars": 3515,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Cloner/StubTest.php",
"chars": 1181,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Cloner/VarClonerTest.php",
"chars": 27077,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Command/Descriptor/CliDescriptorTest.php",
"chars": 6224,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Command/Descriptor/HtmlDescriptorTest.php",
"chars": 7710,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Command/ServerDumpCommandTest.php",
"chars": 1203,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/CliDumperTest.php",
"chars": 14745,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/ContextProvider/RequestContextProviderTest.php",
"chars": 1670,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/ContextualizedDumperTest.php",
"chars": 1436,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/FunctionsTest.php",
"chars": 2146,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/HtmlDumperTest.php",
"chars": 12737,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/ServerDumperTest.php",
"chars": 3070,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Dumper/functions/dd_with_accept_header_json_array.phpt",
"chars": 379,
"preview": "--TEST--\nTest dd() with \"Accept: application/json\" uses CliDumper with php://output\n--FILE--\n<?php\nputenv('NO_COLOR=1');"
},
{
"path": "Tests/Dumper/functions/dd_with_multiple_args.phpt",
"chars": 282,
"preview": "--TEST--\nTest dd() with multiple args shows line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile ("
},
{
"path": "Tests/Dumper/functions/dd_with_named_args.phpt",
"chars": 289,
"preview": "--TEST--\nTest dd() with named args show label\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile (!file_exis"
},
{
"path": "Tests/Dumper/functions/dd_with_null.phpt",
"chars": 256,
"preview": "--TEST--\nTest dd() with null doesn't show line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile (!f"
},
{
"path": "Tests/Dumper/functions/dd_with_single_arg.phpt",
"chars": 261,
"preview": "--TEST--\nTest dd() with one arg doesn't show line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile "
},
{
"path": "Tests/Dumper/functions/dump_data_collector_with_spl_array.phpt",
"chars": 1835,
"preview": "--TEST--\nTest integration with Symfony's DumpDataCollector\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhil"
},
{
"path": "Tests/Dumper/functions/dump_with_accept_header_html.phpt",
"chars": 335,
"preview": "--TEST--\nTest dump() with \"Accept: text/html\" uses HTML dumper\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\n"
},
{
"path": "Tests/Dumper/functions/dump_with_accept_header_json_array.phpt",
"chars": 384,
"preview": "--TEST--\nTest dump() with \"Accept: application/json\" uses CliDumper with php://output\n--FILE--\n<?php\nputenv('NO_COLOR=1'"
},
{
"path": "Tests/Dumper/functions/dump_with_accept_header_json_multiple_args.phpt",
"chars": 407,
"preview": "--TEST--\nTest dump() with \"Accept: application/json\" uses CliDumper with php://output\n--FILE--\n<?php\nputenv('NO_COLOR=1'"
},
{
"path": "Tests/Dumper/functions/dump_with_accept_header_json_string.phpt",
"chars": 364,
"preview": "--TEST--\nTest dump() with \"Accept: application/json\" uses CliDumper with php://output\n--FILE--\n<?php\nputenv('NO_COLOR=1'"
},
{
"path": "Tests/Dumper/functions/dump_with_accept_header_wildcard.phpt",
"chars": 331,
"preview": "--TEST--\nTest dump() with \"Accept: */*\" uses HTML dumper\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile "
},
{
"path": "Tests/Dumper/functions/dump_with_multiple_args.phpt",
"chars": 286,
"preview": "--TEST--\nTest dump() with multiple args shows line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile"
},
{
"path": "Tests/Dumper/functions/dump_with_named_args.phpt",
"chars": 324,
"preview": "--TEST--\nTest dd() with named args show label\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile (!file_exis"
},
{
"path": "Tests/Dumper/functions/dump_with_null.phpt",
"chars": 260,
"preview": "--TEST--\nTest dump() with null doesn't show line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile ("
},
{
"path": "Tests/Dumper/functions/dump_with_single_arg.phpt",
"chars": 265,
"preview": "--TEST--\nTest dump() with one arg doesn't show line number\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhil"
},
{
"path": "Tests/Dumper/functions/dump_without_args.phpt",
"chars": 249,
"preview": "--TEST--\nTest dd() without args displays debug hint\n--FILE--\n<?php\nputenv('NO_COLOR=1');\n\n$vendor = __DIR__;\nwhile (!fil"
},
{
"path": "Tests/Fixtures/BackedEnumFixture.php",
"chars": 190,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nenum BackedEnumFixture: string {\n case Hearts = 'H';\n "
},
{
"path": "Tests/Fixtures/DateTimeChild.php",
"chars": 149,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass DateTimeChild extends \\DateTimeImmutable\n{\n priva"
},
{
"path": "Tests/Fixtures/ExtendsReflectionTypeFixture.php",
"chars": 348,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass ExtendsReflectionTypeFixture extends \\ReflectionType"
},
{
"path": "Tests/Fixtures/FooInterface.php",
"chars": 181,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\ninterface FooInterface\n{\n /**\n * Hello.\n */\n "
},
{
"path": "Tests/Fixtures/GeneratorDemo.php",
"chars": 270,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass GeneratorDemo\n{\n public static function foo()\n "
},
{
"path": "Tests/Fixtures/LotsOfAttributes.php",
"chars": 661,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Fixtures/MyAttribute.php",
"chars": 621,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Fixtures/NotLoadableClass.php",
"chars": 114,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass NotLoadableClass extends NotLoadableClass\n{\n}\n"
},
{
"path": "Tests/Fixtures/Php74.php",
"chars": 268,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass Php74\n{\n public $p1 = 123;\n public \\stdClass $"
},
{
"path": "Tests/Fixtures/Php81Enums.php",
"chars": 290,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass Php81Enums\n{\n public UnitEnumFixture $e1;\n pub"
},
{
"path": "Tests/Fixtures/Php82NullStandaloneReturnType.php",
"chars": 407,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Fixtures/ReflectionIntersectionTypeFixture.php",
"chars": 145,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass ReflectionIntersectionTypeFixture\n{\n public \\Trav"
},
{
"path": "Tests/Fixtures/ReflectionNamedTypeFixture.php",
"chars": 118,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass ReflectionNamedTypeFixture\n{\n public int $a;\n}\n"
},
{
"path": "Tests/Fixtures/ReflectionUnionTypeFixture.php",
"chars": 125,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass ReflectionUnionTypeFixture\n{\n public int|string $"
},
{
"path": "Tests/Fixtures/ReflectionUnionTypeWithIntersectionFixture.php",
"chars": 161,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass ReflectionUnionTypeWithIntersectionFixture\n{\n pub"
},
{
"path": "Tests/Fixtures/Twig.php",
"chars": 1130,
"preview": "<?php\n\nabstract class AbstractTwigTemplate extends Twig\\Template\n{\n private function createError()\n {\n retu"
},
{
"path": "Tests/Fixtures/UnitEnumFixture.php",
"chars": 156,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nenum UnitEnumFixture {\n case Hearts;\n case Diamonds;"
},
{
"path": "Tests/Fixtures/VirtualProperty.php",
"chars": 360,
"preview": "<?php\n\nnamespace Symfony\\Component\\VarDumper\\Tests\\Fixtures;\n\nclass VirtualProperty\n{\n public string $firstName = 'Jo"
},
{
"path": "Tests/Fixtures/dumb-var.php",
"chars": 1107,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Fixtures/dump_server.php",
"chars": 996,
"preview": "<?php\n\nuse Symfony\\Component\\VarDumper\\Cloner\\Data;\nuse Symfony\\Component\\VarDumper\\Cloner\\VarCloner;\nuse Symfony\\Compon"
},
{
"path": "Tests/Fixtures/xml_reader.xml",
"chars": 223,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n <bar></bar>\n <bar />\n <bar>With text</bar>\n <bar foo=\"bar\" baz"
},
{
"path": "Tests/Server/ConnectionTest.php",
"chars": 2702,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "Tests/Test/VarDumperTestTraitTest.php",
"chars": 2374,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "VarDumper.php",
"chars": 4331,
"preview": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the ful"
},
{
"path": "composer.json",
"chars": 1191,
"preview": "{\n \"name\": \"symfony/var-dumper\",\n \"type\": \"library\",\n \"description\": \"Provides mechanisms for walking through a"
},
{
"path": "phpunit.xml.dist",
"chars": 1220,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:noNa"
}
]
About this extraction
This page contains the full source code of the symfony/var-dumper GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 162 files (560.8 KB), approximately 145.8k tokens, and a symbol index with 707 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.