updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class AmqpCaster
{
private static $flags = array(
private static $flags = [
AMQP_DURABLE => 'AMQP_DURABLE',
AMQP_PASSIVE => 'AMQP_PASSIVE',
AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
@@ -35,22 +35,22 @@ class AmqpCaster
AMQP_MULTIPLE => 'AMQP_MULTIPLE',
AMQP_NOWAIT => 'AMQP_NOWAIT',
AMQP_REQUEUE => 'AMQP_REQUEUE',
);
];
private static $exchangeTypes = array(
private static $exchangeTypes = [
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, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$a += [
$prefix.'is_connected' => $c->isConnected(),
);
];
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPConnection\x00login"])) {
@@ -64,7 +64,7 @@ class AmqpCaster
$timeout = $c->getTimeout();
}
$a += array(
$a += [
$prefix.'is_connected' => $c->isConnected(),
$prefix.'login' => $c->getLogin(),
$prefix.'password' => $c->getPassword(),
@@ -72,7 +72,7 @@ class AmqpCaster
$prefix.'vhost' => $c->getVhost(),
$prefix.'port' => $c->getPort(),
$prefix.'read_timeout' => $timeout,
);
];
return $a;
}
@@ -81,21 +81,21 @@ class AmqpCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$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 += array(
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'prefetch_size' => $c->getPrefetchSize(),
$prefix.'prefetch_count' => $c->getPrefetchCount(),
);
];
return $a;
}
@@ -104,21 +104,21 @@ class AmqpCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
);
];
// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPQueue\x00name"])) {
return $a;
}
$a += array(
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'arguments' => $c->getArguments(),
);
];
return $a;
}
@@ -127,9 +127,9 @@ class AmqpCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
);
];
$type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType();
@@ -140,13 +140,13 @@ class AmqpCaster
return $a;
}
$a += array(
$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'type' => $type,
$prefix.'arguments' => $c->getArguments(),
);
];
return $a;
}
@@ -165,10 +165,10 @@ class AmqpCaster
}
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$a += array($prefix.'body' => $c->getBody());
$a += [$prefix.'body' => $c->getBody()];
}
$a += array(
$a += [
$prefix.'delivery_tag' => $c->getDeliveryTag(),
$prefix.'is_redelivery' => $c->isRedelivery(),
$prefix.'exchange_name' => $c->getExchangeName(),
@@ -186,14 +186,14 @@ class AmqpCaster
$prefix.'type' => $c->getType(),
$prefix.'user_id' => $c->getUserId(),
$prefix.'app_id' => $c->getAppId(),
);
];
return $a;
}
private static function extractFlags($flags)
{
$flagsArray = array();
$flagsArray = [];
foreach (self::$flags as $value => $name) {
if ($flags & $value) {
@@ -202,7 +202,7 @@ class AmqpCaster
}
if (!$flagsArray) {
$flagsArray = array('AMQP_NOPARAM');
$flagsArray = ['AMQP_NOPARAM'];
}
return new ConstStub(implode('|', $flagsArray), $flags);

View File

@@ -20,13 +20,13 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class ArgsStub extends EnumStub
{
private static $parameters = array();
private static $parameters = [];
public function __construct(array $args, string $function, ?string $class)
{
list($variadic, $params) = self::getParameters($function, $class);
$values = array();
$values = [];
foreach ($args as $k => $v) {
$values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
}
@@ -41,7 +41,7 @@ class ArgsStub extends EnumStub
$values[] = new EnumStub(array_splice($values, \count($params)), false);
$params[] = $variadic;
}
if (array('...') === $params) {
if (['...'] === $params) {
$this->dumpKeys = false;
$this->value = $values[0]->value;
} else {
@@ -58,11 +58,11 @@ class ArgsStub extends EnumStub
try {
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
} catch (\ReflectionException $e) {
return array(null, null);
return [null, null];
}
$variadic = '...';
$params = array();
$params = [];
foreach ($r->getParameters() as $v) {
$k = '$'.$v->name;
if ($v->isPassedByReference()) {
@@ -75,6 +75,6 @@ class ArgsStub extends EnumStub
}
}
return self::$parameters[$k] = array($variadic, $params);
return self::$parameters[$k] = [$variadic, $params];
}
}

View File

@@ -51,7 +51,7 @@ class Caster
if ($hasDebugInfo) {
$a = $obj->__debugInfo();
} elseif ($obj instanceof \Closure) {
$a = array();
$a = [];
} else {
$a = (array) $obj;
}
@@ -60,10 +60,10 @@ class Caster
}
if ($a) {
static $publicProperties = array();
static $publicProperties = [];
$i = 0;
$prefixedKeys = array();
$prefixedKeys = [];
foreach ($a as $k => $v) {
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
if (!isset($publicProperties[$class])) {
@@ -104,7 +104,7 @@ class Caster
*
* @return array The filtered array
*/
public static function filter(array $a, $filter, array $listedProperties = array(), &$count = 0)
public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0)
{
$count = 0;
@@ -114,7 +114,7 @@ class Caster
if (null === $v) {
$type |= self::EXCLUDE_NULL & $filter;
$type |= self::EXCLUDE_EMPTY & $filter;
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) {
$type |= self::EXCLUDE_EMPTY & $filter;
}
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) {

View File

@@ -33,16 +33,16 @@ class ClassStub extends ConstStub
if ($callable instanceof \Closure) {
$r = new \ReflectionFunction($callable);
} elseif (\is_object($callable)) {
$r = array($callable, '__invoke');
$r = [$callable, '__invoke'];
} elseif (\is_array($callable)) {
$r = $callable;
} elseif (false !== $i = strpos($callable, '::')) {
$r = array(substr($callable, 0, $i), substr($callable, 2 + $i));
$r = [substr($callable, 0, $i), substr($callable, 2 + $i)];
} else {
$r = new \ReflectionFunction($callable);
}
} elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) {
$r = array(substr($identifier, 0, $i), substr($identifier, 2 + $i));
$r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)];
} else {
$r = new \ReflectionClass($identifier);
}
@@ -62,7 +62,7 @@ class ClassStub extends ConstStub
}
if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) {
$s = ReflectionCaster::castFunctionAbstract($r, array(), new Stub(), true);
$s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true);
$s = ReflectionCaster::getSignature($s);
if ('()' === substr($identifier, -2)) {

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class DOMCaster
{
private static $errorCodes = array(
private static $errorCodes = [
DOM_PHP_ERR => 'DOM_PHP_ERR',
DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
@@ -38,9 +38,9 @@ class DOMCaster
DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
);
];
private static $nodeTypes = array(
private static $nodeTypes = [
XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
XML_TEXT_NODE => 'XML_TEXT_NODE',
@@ -59,7 +59,7 @@ class DOMCaster
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 $e, array $a, Stub $stub, $isNested)
{
@@ -73,26 +73,26 @@ class DOMCaster
public static function castLength($dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'length' => $dom->length,
);
];
return $a;
}
public static function castImplementation($dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
Caster::PREFIX_VIRTUAL.'XML' => '2.0',
);
];
return $a;
}
public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
@@ -109,14 +109,14 @@ class DOMCaster
'localName' => $dom->localName,
'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
'textContent' => new CutStub($dom->textContent),
);
];
return $a;
}
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
@@ -125,14 +125,14 @@ class DOMCaster
'namespaceURI' => $dom->namespaceURI,
'ownerDocument' => new CutStub($dom->ownerDocument),
'parentNode' => new CutStub($dom->parentNode),
);
];
return $a;
}
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)
{
$a += array(
$a += [
'doctype' => $dom->doctype,
'implementation' => $dom->implementation,
'documentElement' => new CutStub($dom->documentElement),
@@ -152,12 +152,12 @@ class DOMCaster
'preserveWhiteSpace' => $dom->preserveWhiteSpace,
'recover' => $dom->recover,
'substituteEntities' => $dom->substituteEntities,
);
];
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$formatOutput = $dom->formatOutput;
$dom->formatOutput = true;
$a += array(Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML());
$a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()];
$dom->formatOutput = $formatOutput;
}
@@ -166,136 +166,136 @@ class DOMCaster
public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'data' => $dom->data,
'length' => $dom->length,
);
];
return $a;
}
public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'name' => $dom->name,
'specified' => $dom->specified,
'value' => $dom->value,
'ownerElement' => $dom->ownerElement,
'schemaTypeInfo' => $dom->schemaTypeInfo,
);
];
return $a;
}
public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'tagName' => $dom->tagName,
'schemaTypeInfo' => $dom->schemaTypeInfo,
);
];
return $a;
}
public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'wholeText' => $dom->wholeText,
);
];
return $a;
}
public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'typeName' => $dom->typeName,
'typeNamespace' => $dom->typeNamespace,
);
];
return $a;
}
public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'severity' => $dom->severity,
'message' => $dom->message,
'type' => $dom->type,
'relatedException' => $dom->relatedException,
'related_data' => $dom->related_data,
'location' => $dom->location,
);
];
return $a;
}
public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'lineNumber' => $dom->lineNumber,
'columnNumber' => $dom->columnNumber,
'offset' => $dom->offset,
'relatedNode' => $dom->relatedNode,
'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
);
];
return $a;
}
public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'name' => $dom->name,
'entities' => $dom->entities,
'notations' => $dom->notations,
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'internalSubset' => $dom->internalSubset,
);
];
return $a;
}
public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
);
];
return $a;
}
public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'notationName' => $dom->notationName,
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'version' => $dom->version,
);
];
return $a;
}
public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'target' => $dom->target,
'data' => $dom->data,
);
];
return $a;
}
public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
'document' => $dom->document,
);
];
return $a;
}

View File

@@ -33,7 +33,7 @@ class DateCaster
.($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
;
$a = array();
$a = [];
$a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title);
$stub->class .= $d->format(' @U');
@@ -47,7 +47,7 @@ class DateCaster
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
$title = number_format($numberOfSeconds, 0, '.', ' ').'s';
$i = array(Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title));
$i = [Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title)];
return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a;
}
@@ -75,14 +75,14 @@ class DateCaster
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
$z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title));
$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, $isNested, $filter)
{
$dates = array();
$dates = [];
if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/bug.php?id=74639
foreach (clone $p as $i => $d) {
if (self::PERIOD_LIMIT === $i) {
@@ -105,7 +105,7 @@ class DateCaster
($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end) : 'recurring '.$p->recurrences.' time/s'
);
$p = array(Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates)));
$p = [Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))];
return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a;
}

View File

@@ -25,8 +25,8 @@ class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
{
foreach (array('__cloner__', '__initializer__') as $k) {
if (array_key_exists($k, $a)) {
foreach (['__cloner__', '__initializer__'] as $k) {
if (\array_key_exists($k, $a)) {
unset($a[$k]);
++$stub->cut;
}
@@ -37,8 +37,8 @@ class DoctrineCaster
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
{
foreach (array('_entityPersister', '_identifier') as $k) {
if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
foreach (['_entityPersister', '_identifier'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
unset($a[$k]);
++$stub->cut;
}
@@ -49,8 +49,8 @@ class DoctrineCaster
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
{
foreach (array('snapshot', 'association', 'typeClass') as $k) {
if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
foreach (['snapshot', 'association', 'typeClass'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
$a[$k] = new CutStub($a[$k]);
}
}

View File

@@ -24,7 +24,7 @@ class ExceptionCaster
{
public static $srcContext = 1;
public static $traceArgs = true;
public static $errorTypes = array(
public static $errorTypes = [
E_DEPRECATED => 'E_DEPRECATED',
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
@@ -40,9 +40,9 @@ class ExceptionCaster
E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT',
);
];
private static $framesCache = array();
private static $framesCache = [];
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
{
@@ -94,10 +94,10 @@ class ExceptionCaster
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
}
$trace = array(array(
$trace = [[
'file' => $a[$sPrefix.'file'],
'line' => $a[$sPrefix.'line'],
));
]];
if (isset($a[$sPrefix.'trace'])) {
$trace = array_merge($trace, $a[$sPrefix.'trace']);
@@ -119,16 +119,16 @@ class ExceptionCaster
$frames = $trace->value;
$prefix = Caster::PREFIX_VIRTUAL;
$a = array();
$a = [];
$j = \count($frames);
if (0 > $i = $trace->sliceOffset) {
$i = max(0, $j + $i);
}
if (!isset($trace->value[$i])) {
return array();
return [];
}
$lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
$frames[] = array('function' => '');
$frames[] = ['function' => ''];
$collapse = false;
for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
@@ -136,16 +136,16 @@ class ExceptionCaster
$call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???';
$frame = new FrameStub(
array(
[
'object' => isset($f['object']) ? $f['object'] : null,
'class' => isset($f['class']) ? $f['class'] : null,
'type' => isset($f['type']) ? $f['type'] : null,
'function' => isset($f['function']) ? $f['function'] : null,
) + $frames[$i - 1],
] + $frames[$i - 1],
false,
true
);
$f = self::castFrameStub($frame, array(), $frame, true);
$f = self::castFrameStub($frame, [], $frame, true);
if (isset($f[$prefix.'src'])) {
foreach ($f[$prefix.'src']->value as $label => $frame) {
if (0 === strpos($label, "\0~collapse=0")) {
@@ -241,7 +241,7 @@ class ExceptionCaster
$srcAttr .= '&separator=:';
}
$srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : '';
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(array("\0~$srcAttr\0$srcKey" => $src));
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(["\0~$srcAttr\0$srcKey" => $src]);
}
}
@@ -267,7 +267,7 @@ class ExceptionCaster
$trace = $a[$xPrefix.'trace'];
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
} else {
$trace = array();
$trace = [];
}
if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) {
@@ -299,23 +299,23 @@ class ExceptionCaster
if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
return;
}
array_unshift($trace, array(
array_unshift($trace, [
'function' => $class ? 'new '.$class : null,
'file' => $file,
'line' => $line,
));
]);
}
private static function extractSource($srcLines, $line, $srcContext, $title, $lang, $file = null)
{
$srcLines = explode("\n", $srcLines);
$src = array();
$src = [];
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
}
$srcLines = array();
$srcLines = [];
$ltrim = 0;
do {
$pad = null;

View File

@@ -21,20 +21,20 @@ class IntlCaster
{
public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, $isNested)
{
$a += 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, $isNested, $filter = 0)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
);
];
if ($filter & Caster::EXCLUDE_VERBOSE) {
$stub->cut += 3;
@@ -42,9 +42,9 @@ class IntlCaster
return self::castError($c, $a);
}
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'attributes' => new EnumStub(
array(
[
'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),
@@ -65,10 +65,10 @@ class IntlCaster
'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(
array(
[
'POSITIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX),
'POSITIVE_SUFFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_SUFFIX),
'NEGATIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX),
@@ -77,10 +77,10 @@ class IntlCaster
'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(
array(
[
'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),
@@ -99,25 +99,25 @@ class IntlCaster
'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, $isNested)
{
$a += 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 += array(
$a += [
Caster::PREFIX_VIRTUAL.'dst_savings' => $c->getDSTSavings(),
);
];
}
return self::castError($c, $a);
@@ -125,25 +125,24 @@ class IntlCaster
public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, $isNested, $filter = 0)
{
$a += 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.'type' => $c->getType(),
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, $isNested, $filter = 0)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
Caster::PREFIX_VIRTUAL.'calendar' => $c->getCalendar(),
@@ -152,7 +151,7 @@ class IntlCaster
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);
}
@@ -160,10 +159,10 @@ class IntlCaster
private static function castError($c, array $a): array
{
if ($errorCode = $c->getErrorCode()) {
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'error_code' => $errorCode,
Caster::PREFIX_VIRTUAL.'error_message' => $c->getErrorMessage(),
);
];
}
return $a;

View File

@@ -66,7 +66,7 @@ class LinkStub extends ConstStub
private function getComposerRoot($file, &$inVendor)
{
if (null === self::$vendorRoots) {
self::$vendorRoots = array();
self::$vendorRoots = [];
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {

View File

@@ -23,12 +23,12 @@ class MemcachedCaster
public static function castMemcached(\Memcached $c, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(),
Caster::PREFIX_VIRTUAL.'options' => new EnumStub(
self::getNonDefaultOptions($c)
),
);
];
return $a;
}
@@ -38,7 +38,7 @@ class MemcachedCaster
self::$defaultOptions = self::$defaultOptions ?? self::discoverDefaultOptions();
self::$optionConstants = self::$optionConstants ?? self::getOptionConstants();
$nonDefaultOptions = array();
$nonDefaultOptions = [];
foreach (self::$optionConstants as $constantKey => $value) {
if (self::$defaultOptions[$constantKey] !== $option = $c->getOption($value)) {
$nonDefaultOptions[$constantKey] = $option;
@@ -53,7 +53,7 @@ class MemcachedCaster
$defaultMemcached = new \Memcached();
$defaultMemcached->addServer('127.0.0.1', 11211);
$defaultOptions = array();
$defaultOptions = [];
self::$optionConstants = self::$optionConstants ?? self::getOptionConstants();
foreach (self::$optionConstants as $constantKey => $value) {
@@ -67,7 +67,7 @@ class MemcachedCaster
{
$reflectedMemcached = new \ReflectionClass(\Memcached::class);
$optionConstants = array();
$optionConstants = [];
foreach ($reflectedMemcached->getConstants() as $constantKey => $value) {
if (0 === strpos($constantKey, 'OPT_')) {
$optionConstants[$constantKey] = $value;

View File

@@ -20,53 +20,53 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class PdoCaster
{
private static $pdoAttributes = array(
'CASE' => array(
private static $pdoAttributes = [
'CASE' => [
\PDO::CASE_LOWER => 'LOWER',
\PDO::CASE_NATURAL => 'NATURAL',
\PDO::CASE_UPPER => 'UPPER',
),
'ERRMODE' => array(
],
'ERRMODE' => [
\PDO::ERRMODE_SILENT => 'SILENT',
\PDO::ERRMODE_WARNING => 'WARNING',
\PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
),
],
'TIMEOUT',
'PREFETCH',
'AUTOCOMMIT',
'PERSISTENT',
'DRIVER_NAME',
'SERVER_INFO',
'ORACLE_NULLS' => array(
'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' => array(
'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, $isNested)
{
$attr = array();
$attr = [];
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
foreach (self::$pdoAttributes as $k => $v) {
if (!isset($k[0])) {
$k = $v;
$v = array();
$v = [];
}
try {
@@ -85,11 +85,11 @@ class PdoCaster
}
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$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();

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class PgSqlCaster
{
private static $paramCodes = array(
private static $paramCodes = [
'server_encoding',
'client_encoding',
'is_superuser',
@@ -31,17 +31,17 @@ class PgSqlCaster
'integer_datetimes',
'application_name',
'standard_conforming_strings',
);
];
private static $transactionStatus = array(
private static $transactionStatus = [
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 static $resultStatus = array(
private static $resultStatus = [
PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
@@ -50,9 +50,9 @@ class PgSqlCaster
PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
);
];
private static $diagCodes = array(
private static $diagCodes = [
'severity' => PGSQL_DIAG_SEVERITY,
'sqlstate' => PGSQL_DIAG_SQLSTATE,
'message' => PGSQL_DIAG_MESSAGE_PRIMARY,
@@ -65,7 +65,7 @@ class PgSqlCaster
'file' => PGSQL_DIAG_SOURCE_FILE,
'line' => PGSQL_DIAG_SOURCE_LINE,
'function' => PGSQL_DIAG_SOURCE_FUNCTION,
);
];
public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
{
@@ -127,14 +127,14 @@ class PgSqlCaster
$fields = pg_num_fields($result);
for ($i = 0; $i < $fields; ++$i) {
$field = array(
$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, $i),
'storage' => pg_field_size($result, $i).' bytes',
'display' => pg_field_prtlen($result, $i).' chars',
);
];
if (' (OID: )' === $field['table']) {
$field['table'] = null;
}

View File

@@ -20,43 +20,43 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class RedisCaster
{
private static $serializer = array(
private static $serializer = [
\Redis::SERIALIZER_NONE => 'NONE',
\Redis::SERIALIZER_PHP => 'PHP',
2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
);
];
private static $mode = array(
private static $mode = [
\Redis::ATOMIC => 'ATOMIC',
\Redis::MULTI => 'MULTI',
\Redis::PIPELINE => 'PIPELINE',
);
];
private static $compression = array(
private static $compression = [
0 => 'NONE', // Redis::COMPRESSION_NONE
1 => 'LZF', // Redis::COMPRESSION_LZF
);
];
private static $failover = array(
private static $failover = [
\RedisCluster::FAILOVER_NONE => 'NONE',
\RedisCluster::FAILOVER_ERROR => 'ERROR',
\RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
\RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
);
];
public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
if (!$connected = $c->isConnected()) {
return $a + array(
return $a + [
$prefix.'isConnected' => $connected,
);
];
}
$mode = $c->getMode();
return $a + array(
return $a + [
$prefix.'isConnected' => $connected,
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
@@ -67,19 +67,19 @@ class RedisCaster
$prefix.'lastError' => $c->getLastError(),
$prefix.'persistentId' => $c->getPersistentID(),
$prefix.'options' => self::getRedisOptions($c),
);
];
}
public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
return $a + array(
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, $isNested)
@@ -87,15 +87,15 @@ class RedisCaster
$prefix = Caster::PREFIX_VIRTUAL;
$failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
$a += array(
$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, array(
$prefix.'options' => self::getRedisOptions($c, [
'SLAVE_FAILOVER' => isset(self::$failover[$failover]) ? new ConstStub(self::$failover[$failover], $failover) : $failover,
)),
);
]),
];
return $a;
}
@@ -103,7 +103,7 @@ class RedisCaster
/**
* @param \Redis|\RedisArray|\RedisCluster $redis
*/
private static function getRedisOptions($redis, array $options = array()): EnumStub
private static function getRedisOptions($redis, array $options = []): EnumStub
{
$serializer = $redis->getOption(\Redis::OPT_SERIALIZER);
if (\is_array($serializer)) {
@@ -136,14 +136,14 @@ class RedisCaster
$retry = new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry);
}
$options += array(
$options += [
'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : 0,
'READ_TIMEOUT' => $redis->getOption(\Redis::OPT_READ_TIMEOUT),
'COMPRESSION' => $compression,
'SERIALIZER' => $serializer,
'PREFIX' => $redis->getOption(\Redis::OPT_PREFIX),
'SCAN' => $retry,
);
];
return new EnumStub($options);
}

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class ReflectionCaster
{
private static $extraMap = array(
private static $extraMap = [
'docComment' => 'getDocComment',
'extension' => 'getExtensionName',
'isDisabled' => 'isDisabled',
@@ -29,7 +29,7 @@ class ReflectionCaster
'isUserDefined' => 'isUserDefined',
'isGenerator' => 'isGenerator',
'isVariadic' => 'isVariadic',
);
];
public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
{
@@ -49,14 +49,14 @@ class ReflectionCaster
if ($filter & Caster::EXCLUDE_VERBOSE) {
$stub->cut += ($c->getFileName() ? 2 : 0) + \count($a);
return array();
return [];
}
if (isset($a[$prefix.'parameters'])) {
foreach ($a[$prefix.'parameters']->value as &$v) {
$param = $v;
$v = new EnumStub(array());
foreach (static::castParameter($param, array(), $stub, true) as $k => $param) {
$v = new EnumStub([]);
foreach (static::castParameter($param, [], $stub, true) as $k => $param) {
if ("\0" === $k[0]) {
$v->value[substr($k, 3)] = $param;
}
@@ -95,11 +95,11 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += array(
$a += [
$prefix.'name' => $c->getName(),
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
);
];
return $a;
}
@@ -112,28 +112,28 @@ class ReflectionCaster
$a[$prefix.'this'] = new CutStub($c->getThis());
}
$function = $c->getFunction();
$frame = array(
$frame = [
'class' => isset($function->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, array(
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine() - 1,
));
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
} else {
$function = new FrameStub($frame, false, true);
$function = ExceptionCaster::castFrameStub($function, array(), $function, true);
$a[$prefix.'executing'] = new EnumStub(array(
$function = ExceptionCaster::castFrameStub($function, [], $function, true);
$a[$prefix.'executing'] = new EnumStub([
"\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
));
]);
}
$a[Caster::PREFIX_VIRTUAL.'closed'] = false;
@@ -149,11 +149,11 @@ class ReflectionCaster
$a[$prefix.'modifiers'] = implode(' ', $n);
}
self::addMap($a, $c, array(
self::addMap($a, $c, [
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getConstants',
));
]);
foreach ($c->getProperties() as $n) {
$a[$prefix.'properties'][$n->name] = $n;
@@ -174,17 +174,17 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
self::addMap($a, $c, array(
self::addMap($a, $c, [
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureScopeClass',
'this' => 'getClosureThis',
));
]);
if (isset($a[$prefix.'returnType'])) {
$v = $a[$prefix.'returnType'];
$v = $v->getName();
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$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']);
@@ -237,12 +237,12 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
self::addMap($a, $c, array(
self::addMap($a, $c, [
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
'byReference' => 'isPassedByReference',
'allowsNull' => 'allowsNull',
));
]);
if ($v = $c->getType()) {
$a[$prefix.'typeHint'] = $v->getName();
@@ -250,7 +250,7 @@ class ReflectionCaster
if (isset($a[$prefix.'typeHint'])) {
$v = $a[$prefix.'typeHint'];
$a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
$a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
} else {
unset($a[$prefix.'allowsNull']);
}
@@ -279,7 +279,7 @@ class ReflectionCaster
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)
{
self::addMap($a, $c, array(
self::addMap($a, $c, [
'version' => 'getVersion',
'dependencies' => 'getDependencies',
'iniEntries' => 'getIniEntries',
@@ -288,19 +288,19 @@ class ReflectionCaster
'constants' => 'getConstants',
'functions' => 'getFunctions',
'classes' => 'getClasses',
));
]);
return $a;
}
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)
{
self::addMap($a, $c, array(
self::addMap($a, $c, [
'version' => 'getVersion',
'author' => 'getAuthor',
'copyright' => 'getCopyright',
'url' => 'getURL',
));
]);
return $a;
}
@@ -353,7 +353,7 @@ class ReflectionCaster
private static function addExtra(&$a, \Reflector $c)
{
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : array();
$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());

View File

@@ -20,12 +20,12 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class SplCaster
{
private static $splFileObjectFlags = array(
private static $splFileObjectFlags = [
\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, $isNested)
{
@@ -39,9 +39,9 @@ class SplCaster
public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
);
];
return $a;
}
@@ -52,10 +52,10 @@ class SplCaster
$mode = $c->getIteratorMode();
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
$a += array(
$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;
@@ -63,7 +63,7 @@ class SplCaster
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)
{
static $map = array(
static $map = [
'path' => 'getPath',
'filename' => 'getFilename',
'basename' => 'getBasename',
@@ -86,7 +86,7 @@ class SplCaster
'dir' => 'isDir',
'link' => 'isLink',
'linkTarget' => 'getLinkTarget',
);
];
$prefix = Caster::PREFIX_VIRTUAL;
@@ -105,7 +105,7 @@ class SplCaster
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
}
static $mapDate = array('aTime', 'mTime', 'cTime');
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]);
@@ -117,14 +117,14 @@ class SplCaster
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)
{
static $map = array(
static $map = [
'csvControl' => 'getCsvControl',
'flags' => 'getFlags',
'maxLineLen' => 'getMaxLineLen',
'fstat' => 'fstat',
'eof' => 'eof',
'key' => 'key',
);
];
$prefix = Caster::PREFIX_VIRTUAL;
@@ -136,7 +136,7 @@ class SplCaster
}
if (isset($a[$prefix.'flags'])) {
$flagsArray = array();
$flagsArray = [];
foreach (self::$splFileObjectFlags as $value => $name) {
if ($a[$prefix.'flags'] & $value) {
$flagsArray[] = $name;
@@ -146,7 +146,7 @@ class SplCaster
}
if (isset($a[$prefix.'fstat'])) {
$a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], array('dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks'));
$a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']);
}
return $a;
@@ -154,29 +154,29 @@ class SplCaster
public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)
{
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
);
];
return $a;
}
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
{
$storage = array();
$storage = [];
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
$clone = clone $c;
foreach ($clone as $obj) {
$storage[] = array(
$storage[] = [
'object' => $obj,
'info' => $clone->getInfo(),
);
];
}
$a += array(
$a += [
Caster::PREFIX_VIRTUAL.'storage' => $storage,
);
];
return $a;
}
@@ -199,10 +199,10 @@ class SplCaster
$a = Caster::castObject($c, $class);
$c->setFlags($flags);
}
$a += array(
$a += [
$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());
}

View File

@@ -35,7 +35,7 @@ class StubCaster
$stub->class = Stub::STRING_BINARY;
}
$a = array();
$a = [];
}
return $a;
@@ -51,7 +51,7 @@ class StubCaster
if ($isNested) {
$stub->cut += \count($a);
return array();
return [];
}
return $a;
@@ -66,7 +66,7 @@ class StubCaster
$stub->cut = $c->cut;
$stub->attr = $c->attr;
$a = array();
$a = [];
if ($c->value) {
foreach (array_keys($c->value) as $k) {

View File

@@ -16,14 +16,14 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class SymfonyCaster
{
private static $requestGetters = array(
private static $requestGetters = [
'pathInfo' => 'getPathInfo',
'requestUri' => 'getRequestUri',
'baseUrl' => 'getBaseUrl',
'basePath' => 'getBasePath',
'method' => 'getMethod',
'format' => 'getRequestFormat',
);
];
public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
{

View File

@@ -19,7 +19,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class XmlReaderCaster
{
private static $nodeTypes = array(
private static $nodeTypes = [
\XMLReader::NONE => 'NONE',
\XMLReader::ELEMENT => 'ELEMENT',
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
@@ -38,12 +38,12 @@ class XmlReaderCaster
\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, $isNested)
{
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
$info = array(
$info = [
'localName' => $reader->localName,
'prefix' => $reader->prefix,
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
@@ -55,20 +55,20 @@ class XmlReaderCaster
'value' => $reader->value,
'namespaceURI' => $reader->namespaceURI,
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
$props => array(
$props => [
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
),
);
],
];
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) {
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {
$info[$props] = new EnumStub($info[$props]);
$info[$props]->cut = $count;
}
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count);
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count);
// +2 because hasValue and hasAttributes are always filtered
$stub->cut += $count + 2;

View File

@@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class XmlResourceCaster
{
private static $xmlErrors = array(
private static $xmlErrors = [
XML_ERROR_NONE => 'XML_ERROR_NONE',
XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
@@ -43,7 +43,7 @@ class XmlResourceCaster
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, $isNested)
{

View File

@@ -21,133 +21,133 @@ use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
*/
abstract class AbstractCloner implements ClonerInterface
{
public static $defaultCasters = array(
'__PHP_Incomplete_Class' => array('Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'),
public static $defaultCasters = [
'__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'],
'Symfony\Component\VarDumper\Caster\CutStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'),
'Symfony\Component\VarDumper\Caster\CutArrayStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'),
'Symfony\Component\VarDumper\Caster\ConstStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'),
'Symfony\Component\VarDumper\Caster\EnumStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'),
'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'],
'Closure' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'),
'Generator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'),
'ReflectionType' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'),
'ReflectionGenerator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'),
'ReflectionClass' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'),
'ReflectionFunctionAbstract' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'),
'ReflectionMethod' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'),
'ReflectionParameter' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'),
'ReflectionProperty' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'),
'ReflectionExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'),
'ReflectionZendExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'),
'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'],
'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'],
'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'],
'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'],
'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'],
'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'],
'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'],
'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'],
'Doctrine\Common\Persistence\ObjectManager' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
'Doctrine\Common\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'),
'Doctrine\ORM\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'),
'Doctrine\ORM\PersistentCollection' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'),
'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'],
'DOMException' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'),
'DOMStringList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
'DOMNameList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
'DOMImplementation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'),
'DOMImplementationList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
'DOMNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'),
'DOMNameSpaceNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'),
'DOMDocument' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'),
'DOMNodeList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
'DOMNamedNodeMap' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
'DOMCharacterData' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'),
'DOMAttr' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'),
'DOMElement' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'),
'DOMText' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'),
'DOMTypeinfo' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'),
'DOMDomError' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'),
'DOMLocator' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'),
'DOMDocumentType' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'),
'DOMNotation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'),
'DOMEntity' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'),
'DOMProcessingInstruction' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'),
'DOMXPath' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'),
'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'],
'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'],
'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMCharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'],
'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'],
'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'],
'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
'DOMProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'],
'XmlReader' => array('Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'),
'XmlReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'],
'ErrorException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'),
'Exception' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'),
'Error' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'),
'Symfony\Component\DependencyInjection\ContainerInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
'Symfony\Component\HttpFoundation\Request' => array('Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'),
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'),
'Symfony\Component\VarDumper\Caster\TraceStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'),
'Symfony\Component\VarDumper\Caster\FrameStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'),
'Symfony\Component\Debug\Exception\SilencedErrorContext' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'),
'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'],
'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'],
'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'],
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
'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\Debug\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
'ProxyManager\Proxy\ProxyInterface' => array('Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'),
'PHPUnit_Framework_MockObject_MockObject' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
'Prophecy\Prophecy\ProphecySubjectInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
'Mockery\MockInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PDO' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'),
'PDOStatement' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'),
'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'],
'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'],
'AMQPConnection' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'),
'AMQPChannel' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'),
'AMQPQueue' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'),
'AMQPExchange' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'),
'AMQPEnvelope' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'),
'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' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'),
'ArrayIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'),
'SplDoublyLinkedList' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'),
'SplFileInfo' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'),
'SplFileObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'),
'SplFixedArray' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'),
'SplHeap' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'),
'SplObjectStorage' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'),
'SplPriorityQueue' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'),
'OuterIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'),
'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'],
'SplFixedArray' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'],
'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'],
'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'),
'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'),
'RedisCluster' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'),
'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'],
'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'],
'DateTimeInterface' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'),
'DateInterval' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'),
'DateTimeZone' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'),
'DatePeriod' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'),
'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' => array('Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'),
'GMP' => ['Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'],
'MessageFormatter' => array('Symfony\Component\VarDumper\Caster\IntlCaster', 'castMessageFormatter'),
'NumberFormatter' => array('Symfony\Component\VarDumper\Caster\IntlCaster', 'castNumberFormatter'),
'IntlTimeZone' => array('Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlTimeZone'),
'IntlCalendar' => array('Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlCalendar'),
'IntlDateFormatter' => array('Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlDateFormatter'),
'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' => array('Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'),
'Memcached' => ['Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'],
':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'),
':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
':gd' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'),
':mysql link' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'),
':pgsql large object' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'),
':pgsql link' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'),
':pgsql link persistent' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'),
':pgsql result' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'),
':process' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'),
':stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'),
':persistent stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'),
':stream-context' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'),
':xml' => array('Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'),
);
':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'],
':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
':pgsql link persistent' => ['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'],
':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'],
':xml' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'],
];
protected $maxItems = 2500;
protected $maxString = -1;
protected $minDepth = 1;
private $casters = array();
private $casters = [];
private $prevErrorHandler;
private $classInfo = array();
private $classInfo = [];
private $filter = 0;
/**
@@ -221,7 +221,7 @@ abstract class AbstractCloner implements ClonerInterface
*/
public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) {
$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);
@@ -278,7 +278,7 @@ abstract class AbstractCloner implements ClonerInterface
list($i, $parents, $hasDebugInfo) = $this->classInfo[$class];
} else {
$i = 2;
$parents = array(strtolower($class));
$parents = [strtolower($class)];
$hasDebugInfo = method_exists($class, '__debugInfo');
foreach (class_parents($class) as $p) {
@@ -291,7 +291,7 @@ abstract class AbstractCloner implements ClonerInterface
}
$parents[] = '*';
$this->classInfo[$class] = array($i, $parents, $hasDebugInfo);
$this->classInfo[$class] = [$i, $parents, $hasDebugInfo];
}
$a = Caster::castObject($obj, $class, $hasDebugInfo);
@@ -305,7 +305,7 @@ abstract class AbstractCloner implements ClonerInterface
}
}
} catch (\Exception $e) {
$a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a;
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
@@ -321,7 +321,7 @@ abstract class AbstractCloner implements ClonerInterface
*/
protected function castResource(Stub $stub, $isNested)
{
$a = array();
$a = [];
$res = $stub->value;
$type = $stub->class;
@@ -332,7 +332,7 @@ abstract class AbstractCloner implements ClonerInterface
}
}
} catch (\Exception $e) {
$a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a;
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;

View File

@@ -38,6 +38,6 @@ class Cursor
public $hashLength = 0;
public $hashCut = 0;
public $stop = false;
public $attr = array();
public $attr = [];
public $skipChildren = false;
}

View File

@@ -79,7 +79,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $item->value;
}
$children = $item->position ? $this->data[$item->position] : array();
$children = $item->position ? $this->data[$item->position] : [];
foreach ($children as $k => $v) {
if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
@@ -123,7 +123,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
if (null !== $data = $this->seek($key)) {
$item = $this->getStub($data->data[$data->position][$data->key]);
return $item instanceof Stub || array() === $item ? $data : $item;
return $item instanceof Stub || [] === $item ? $data : $item;
}
}
@@ -225,7 +225,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) {
return;
}
$keys = array($key);
$keys = [$key];
switch ($item->type) {
case Stub::TYPE_OBJECT:
@@ -245,7 +245,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$children = $this->data[$item->position];
foreach ($keys as $key) {
if (isset($children[$key]) || array_key_exists($key, $children)) {
if (isset($children[$key]) || \array_key_exists($key, $children)) {
$data = clone $this;
$data->key = $key;
$data->position = $item->position;
@@ -261,7 +261,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*/
public function dump(DumperInterface $dumper)
{
$refs = array(0);
$refs = [0];
$this->dumpItem($dumper, new Cursor(), $refs, $this->data[$this->position][$this->key]);
}
@@ -281,7 +281,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$firstSeen = true;
if (!$item instanceof Stub) {
$cursor->attr = array();
$cursor->attr = [];
$type = \gettype($item);
if ($item && 'array' === $type) {
$item = $this->getStub($item);
@@ -322,10 +322,10 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
if ($cut >= 0) {
$cut += \count($children);
}
$children = array();
$children = [];
}
} else {
$children = array();
$children = [];
}
switch ($item->type) {
case Stub::TYPE_STRING:

View File

@@ -16,7 +16,7 @@ namespace Symfony\Component\VarDumper\Cloner;
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class Stub implements \Serializable
class Stub
{
const TYPE_REF = 1;
const TYPE_STRING = 2;
@@ -37,21 +37,31 @@ class Stub implements \Serializable
public $handle = 0;
public $refCount = 0;
public $position = 0;
public $attr = array();
public $attr = [];
private static $defaultProperties = [];
/**
* @internal
*/
public function serialize()
public function __sleep()
{
return \serialize(array($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr));
}
$properties = [];
/**
* @internal
*/
public function unserialize($serialized)
{
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = \unserialize($serialized);
if (!isset(self::$defaultProperties[$c = \get_class($this)])) {
self::$defaultProperties[$c] = get_class_vars($c);
foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
unset(self::$defaultProperties[$c][$k]);
}
}
foreach (self::$defaultProperties[$c] as $k => $v) {
if ($this->$k !== $v) {
$properties[] = $k;
}
}
return $properties;
}
}

View File

@@ -17,7 +17,7 @@ namespace Symfony\Component\VarDumper\Cloner;
class VarCloner extends AbstractCloner
{
private static $gid;
private static $arrayCache = array();
private static $arrayCache = [];
/**
* {@inheritdoc}
@@ -27,19 +27,20 @@ class VarCloner extends AbstractCloner
$len = 1; // Length of $queue
$pos = 0; // Number of cloned items past the minimum depth
$refsCounter = 0; // Hard references counter
$queue = array(array($var)); // This breadth-first queue is the return value
$indexedArrays = array(); // Map of queue indexes that hold numerically indexed arrays
$hardRefs = array(); // Map of original zval ids to stub objects
$objRefs = array(); // Map of original object handles to their stub object counterpart
$resRefs = array(); // Map of original resource handles to their stub object counterpart
$values = array(); // Map of stub objects' ids to original values
$queue = [[$var]]; // This breadth-first queue is the return value
$indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays
$hardRefs = []; // Map of original zval ids to stub objects
$objRefs = []; // Map of original object handles to their stub object counterpart
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
$resRefs = []; // Map of original resource handles to their stub object counterpart
$values = []; // Map of stub objects' ids to original values
$maxItems = $this->maxItems;
$maxString = $this->maxString;
$minDepth = $this->minDepth;
$currentDepth = 0; // Current tree depth
$currentDepthFinalIndex = 0; // Final $queue index for current tree depth
$minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
$cookie = (object) array(); // Unique object used to detect hard references
$cookie = (object) []; // Unique object used to detect hard references
$a = null; // Array cast for nested structures
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
@@ -68,7 +69,7 @@ class VarCloner extends AbstractCloner
if (\is_int($k)) {
continue;
}
foreach (array($k => true) as $gk => $gv) {
foreach ([$k => true] as $gk => $gv) {
}
if ($gk !== $k) {
$fromObjCast = true;
@@ -157,7 +158,7 @@ class VarCloner extends AbstractCloner
// Happens with copies of $GLOBALS
if (isset($v[$gid])) {
unset($v[$gid]);
$a = array();
$a = [];
foreach ($v as $gk => &$gv) {
$a[$gk] = &$gv;
}
@@ -193,6 +194,7 @@ class VarCloner extends AbstractCloner
}
if (empty($objRefs[$h])) {
$objRefs[$h] = $stub;
$objects[] = $v;
} else {
$stub = $objRefs[$h];
++$stub->refCount;
@@ -247,12 +249,12 @@ class VarCloner extends AbstractCloner
if ($arrayStub === $stub) {
if ($arrayStub->cut) {
$stub = array($arrayStub->cut, $arrayStub->class => $arrayStub->position);
$stub = [$arrayStub->cut, $arrayStub->class => $arrayStub->position];
$arrayStub->cut = 0;
} elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) {
$stub = self::$arrayCache[$arrayStub->class][$arrayStub->position];
} else {
self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = array($arrayStub->class => $arrayStub->position);
self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = [$arrayStub->class => $arrayStub->position];
}
}
@@ -266,10 +268,10 @@ class VarCloner extends AbstractCloner
if ($fromObjCast) {
$fromObjCast = false;
$refs = $vals;
$vals = array();
$vals = [];
$j = -1;
foreach ($queue[$i] as $k => $v) {
foreach (array($k => true) as $gk => $gv) {
foreach ([$k => true] as $gk => $gv) {
}
if ($gk !== $k) {
$vals = (object) $vals;

View File

@@ -36,10 +36,10 @@ class CliDescriptor implements DumpDescriptorInterface
public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void
{
$io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput(array()), $output);
$io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
$this->dumper->setColors($output->isDecorated());
$rows = array(array('date', date('r', $context['timestamp'])));
$rows = [['date', date('r', $context['timestamp'])]];
$lastIdentifier = $this->lastIdentifier;
$this->lastIdentifier = $clientId;
@@ -49,7 +49,7 @@ class CliDescriptor implements DumpDescriptorInterface
$this->lastIdentifier = $request['identifier'];
$section = sprintf('%s %s', $request['method'], $request['uri']);
if ($controller = $request['controller']) {
$rows[] = array('controller', rtrim($this->dumper->dump($controller, true), "\n"));
$rows[] = ['controller', rtrim($this->dumper->dump($controller, true), "\n")];
}
} elseif (isset($context['cli'])) {
$this->lastIdentifier = $context['cli']['identifier'];
@@ -62,16 +62,16 @@ class CliDescriptor implements DumpDescriptorInterface
if (isset($context['source'])) {
$source = $context['source'];
$rows[] = array('source', sprintf('%s on line %d', $source['name'], $source['line']));
$rows[] = ['source', sprintf('%s on line %d', $source['name'], $source['line'])];
$file = $source['file_relative'] ?? $source['file'];
$rows[] = array('file', $file);
$rows[] = ['file', $file];
$fileLink = $source['file_link'] ?? null;
}
$io->table(array(), $rows);
$io->table([], $rows);
if (isset($fileLink)) {
$io->writeln(array('<info>Open source in your IDE/browser:</info>', $fileLink));
$io->writeln(['<info>Open source in your IDE/browser:</info>', $fileLink]);
$io->newLine();
}

View File

@@ -44,7 +44,7 @@ class HtmlDescriptor implements DumpDescriptorInterface
$title = '-';
if (isset($context['request'])) {
$request = $context['request'];
$controller = "<span class='dumped-tag'>{$this->dumper->dump($request['controller'], true, array('maxDepth' => 0))}</span>";
$controller = "<span class='dumped-tag'>{$this->dumper->dump($request['controller'], true, ['maxDepth' => 0])}</span>";
$title = sprintf('<code>%s</code> <a href="%s">%s</a>', $request['method'], $uri = $request['uri'], $uri);
$dedupIdentifier = $request['identifier'];
} elseif (isset($context['cli'])) {
@@ -65,10 +65,10 @@ class HtmlDescriptor implements DumpDescriptorInterface
}
$isoDate = $this->extractDate($context, 'c');
$tags = array_filter(array(
$tags = array_filter([
'controller' => $controller ?? null,
'project dir' => $projectDir ?? null,
));
]);
$output->writeln(<<<HTML
<article data-dedup-id="$dedupIdentifier">

View File

@@ -41,13 +41,13 @@ class ServerDumpCommand extends Command
/** @var DumpDescriptorInterface[] */
private $descriptors;
public function __construct(DumpServer $server, array $descriptors = array())
public function __construct(DumpServer $server, array $descriptors = [])
{
$this->server = $server;
$this->descriptors = $descriptors + array(
$this->descriptors = $descriptors + [
'cli' => new CliDescriptor(new CliDumper()),
'html' => new HtmlDescriptor(new HtmlDumper()),
);
];
parent::__construct();
}

View File

@@ -39,7 +39,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput
* @param string $charset The default character encoding to use for non-UTF8 strings
* @param string|null $charset The default character encoding to use for non-UTF8 strings
* @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation
*/
public function __construct($output = null, string $charset = null, int $flags = 0)
@@ -73,7 +73,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$output = fopen($output, 'wb');
}
$this->outputStream = $output;
$this->lineDumper = array($this, 'echoLine');
$this->lineDumper = [$this, 'echoLine'];
}
return $prev;

View File

@@ -26,7 +26,7 @@ class CliDumper extends AbstractDumper
protected $colors;
protected $maxStringWidth = 0;
protected $styles = array(
protected $styles = [
// See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
'default' => '38;5;208',
'num' => '1;38;5;38',
@@ -40,17 +40,17 @@ class CliDumper extends AbstractDumper
'meta' => '38;5;170',
'key' => '38;5;113',
'index' => '38;5;38',
);
];
protected static $controlCharsRx = '/[\x00-\x1F\x7F]+/';
protected static $controlCharsMap = array(
protected static $controlCharsMap = [
"\t" => '\t',
"\n" => '\n',
"\v" => '\v',
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
);
];
protected $collapseNextHash = false;
protected $expandNextHash = false;
@@ -64,7 +64,7 @@ class CliDumper extends AbstractDumper
if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
$this->setStyles(array(
$this->setStyles([
'default' => '31',
'num' => '1;34',
'const' => '1;31',
@@ -74,7 +74,7 @@ class CliDumper extends AbstractDumper
'meta' => '35',
'key' => '32',
'index' => '34',
));
]);
}
}
@@ -152,7 +152,7 @@ class CliDumper extends AbstractDumper
break;
default:
$attr += array('value' => $this->utf8Encode($value));
$attr += ['value' => $this->utf8Encode($value)];
$value = $this->utf8Encode($type);
break;
}
@@ -177,10 +177,10 @@ class CliDumper extends AbstractDumper
$this->line .= '""';
$this->endValue($cursor);
} else {
$attr += array(
$attr += [
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
);
];
$str = explode("\n", $str);
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
unset($str[1]);
@@ -272,9 +272,9 @@ class CliDumper extends AbstractDumper
}
if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
$prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), array('count' => $cursor->softRefCount));
$prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]);
} elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) {
$prefix .= $this->style('ref', '&'.$cursor->hardRefTo, array('count' => $cursor->hardRefCount));
$prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]);
} elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) {
$prefix = substr($prefix, 0, -1);
}
@@ -327,7 +327,7 @@ class CliDumper extends AbstractDumper
if ($cursor->hashKeyIsBinary) {
$key = $this->utf8Encode($key);
}
$attr = array('binary' => $cursor->hashKeyIsBinary);
$attr = ['binary' => $cursor->hashKeyIsBinary];
$bin = $cursor->hashKeyIsBinary ? 'b' : '';
$style = 'key';
switch ($cursor->hashType) {
@@ -364,7 +364,7 @@ class CliDumper extends AbstractDumper
$style = 'meta';
if (isset($key[0][1])) {
parse_str(substr($key[0], 1), $attr);
$attr += array('binary' => $cursor->hashKeyIsBinary);
$attr += ['binary' => $cursor->hashKeyIsBinary];
}
break;
case '*':
@@ -389,13 +389,13 @@ class CliDumper extends AbstractDumper
$this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
} else {
// This case should not happen
$this->line .= '-'.$bin.'"'.$this->style('private', $key, array('class' => '')).'": ';
$this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": ';
}
break;
}
if ($cursor->hardRefTo) {
$this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), array('count' => $cursor->hardRefCount)).' ';
$this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), ['count' => $cursor->hardRefCount]).' ';
}
}
}
@@ -409,7 +409,7 @@ class CliDumper extends AbstractDumper
*
* @return string The value with style decoration
*/
protected function style($style, $value, $attr = array())
protected function style($style, $value, $attr = [])
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
@@ -495,7 +495,7 @@ class CliDumper extends AbstractDumper
}
}
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
$h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null];
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
return static::$defaultColors = $this->hasColorSupport($h);

View File

@@ -24,9 +24,9 @@ final class CliContextProvider implements ContextProviderInterface
return null;
}
return array(
return [
'command_line' => $commandLine = implode(' ', $_SERVER['argv']),
'identifier' => hash('crc32b', $commandLine.$_SERVER['REQUEST_TIME_FLOAT']),
);
];
}
}

View File

@@ -39,11 +39,11 @@ final class RequestContextProvider implements ContextProviderInterface
$controller = $request->attributes->get('_controller');
return array(
return [
'uri' => $request->getUri(),
'method' => $request->getMethod(),
'controller' => $controller ? $this->cloner->cloneVar($controller) : $controller,
'identifier' => spl_object_hash($request),
);
];
}
}

View File

@@ -72,7 +72,7 @@ final class SourceContextProvider implements ContextProviderInterface
if ($src) {
$src = explode("\n", $src);
$fileExcerpt = array();
$fileExcerpt = [];
for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) {
$fileExcerpt[] = '<li'.($i === $line ? ' class="selected"' : '').'><code>'.$this->htmlEncode($src[$i - 1]).'</code></li>';
@@ -93,7 +93,7 @@ final class SourceContextProvider implements ContextProviderInterface
$name = substr($name, strrpos($name, '/') + 1);
}
$context = array('name' => $name, 'file' => $file, 'line' => $line);
$context = ['name' => $name, 'file' => $file, 'line' => $line];
$context['file_excerpt'] = $fileExcerpt;
if (null !== $this->projectDir) {

View File

@@ -23,8 +23,8 @@ class HtmlDumper extends CliDumper
{
public static $defaultOutput = 'php://output';
protected static $themes = array(
'dark' => array(
protected static $themes = [
'dark' => [
'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all',
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
@@ -39,8 +39,8 @@ class HtmlDumper extends CliDumper
'index' => 'color:#1299DA',
'ellipsis' => 'color:#FF8400',
'ns' => 'user-select:none;',
),
'light' => array(
],
'light' => [
'default' => 'background:none; color:#CC7832; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all',
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
@@ -55,8 +55,8 @@ class HtmlDumper extends CliDumper
'index' => 'color:#1299DA',
'ellipsis' => 'color:#CC7832',
'ns' => 'user-select:none;',
),
);
],
];
protected $dumpHeader;
protected $dumpPrefix = '<pre class=sf-dump id=%s data-indent-pad="%s">';
@@ -67,12 +67,12 @@ class HtmlDumper extends CliDumper
protected $lastDepth = -1;
protected $styles;
private $displayOptions = array(
private $displayOptions = [
'maxDepth' => 1,
'maxStringLength' => 160,
'fileLinkFormat' => null,
);
private $extraDisplayOptions = array();
];
private $extraDisplayOptions = [];
/**
* {@inheritdoc}
@@ -139,7 +139,7 @@ class HtmlDumper extends CliDumper
/**
* {@inheritdoc}
*/
public function dump(Data $data, $output = null, array $extraDisplayOptions = array())
public function dump(Data $data, $output = null, array $extraDisplayOptions = [])
{
$this->extraDisplayOptions = $extraDisplayOptions;
$result = parent::dump($data, $output);
@@ -500,12 +500,17 @@ return function (root, x) {
function showCurrent(state)
{
var currentNode = state.current();
var currentNode = state.current(), currentRect, searchRect;
if (currentNode) {
reveal(currentNode);
highlight(root, currentNode, state.nodes);
if ('scrollIntoView' in currentNode) {
currentNode.scrollIntoView();
currentNode.scrollIntoView(true);
currentRect = currentNode.getBoundingClientRect();
searchRect = search.getBoundingClientRect();
if (currentRect.top < (searchRect.top + searchRect.height)) {
window.scrollBy(0, -(searchRect.top + searchRect.height + 5));
}
}
}
counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' of ' + state.count();
@@ -517,14 +522,10 @@ return function (root, x) {
<input type="text" class="sf-dump-search-input">
<span class="sf-dump-search-count">0 of 0<\/span>
<button type="button" class="sf-dump-search-input-previous" tabindex="-1">
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M1683 1331l-166 165q-19 19-45 19t-45-19l-531-531-531 531q-19 19-45 19t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19 45-19t45 19l742 741q19 19 19 45.5t-19 45.5z"\/>
<\/svg>
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1683 1331l-166 165q-19 19-45 19t-45-19L896 965l-531 531q-19 19-45 19t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19 45-19t45 19l742 741q19 19 19 45.5t-19 45.5z"\/><\/svg>
<\/button>
<button type="button" class="sf-dump-search-input-next" tabindex="-1">
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path d="M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"\/>
<\/svg>
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1683 808l-742 741q-19 19-45 19t-45-19L109 808q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"\/><\/svg>
<\/button>
';
root.insertBefore(search, root.firstChild);
@@ -641,6 +642,7 @@ pre.sf-dump {
display: block;
white-space: pre;
padding: 5px;
overflow: initial !important;
}
pre.sf-dump:after {
content: "";
@@ -709,14 +711,16 @@ pre.sf-dump code {
border-radius: 3px;
}
pre.sf-dump .sf-dump-search-hidden {
display: none;
display: none !important;
}
pre.sf-dump .sf-dump-search-wrapper {
float: right;
font-size: 0;
white-space: nowrap;
max-width: 100%;
text-align: right;
margin-bottom: 5px;
display: flex;
position: -webkit-sticky;
position: sticky;
top: 5px;
}
pre.sf-dump .sf-dump-search-wrapper > * {
vertical-align: top;
@@ -733,10 +737,11 @@ pre.sf-dump .sf-dump-search-wrapper > input.sf-dump-search-input {
height: 21px;
font-size: 12px;
border-right: none;
width: 140px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
color: #000;
min-width: 15px;
width: 100%;
}
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next,
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous {
@@ -819,7 +824,7 @@ EOHTML
/**
* {@inheritdoc}
*/
protected function style($style, $value, $attr = array())
protected function style($style, $value, $attr = [])
{
if ('' === $value) {
return '';
@@ -919,7 +924,7 @@ EOHTML
}
if (-1 === $depth) {
$args = array('"'.$this->dumpId.'"');
$args = ['"'.$this->dumpId.'"'];
if ($this->extraDisplayOptions) {
$args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
}
@@ -941,7 +946,7 @@ EOHTML
$options = $this->extraDisplayOptions + $this->displayOptions;
if ($fmt = $options['fileLinkFormat']) {
return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line);
}
return false;

View File

@@ -30,7 +30,7 @@ class ServerDumper implements DataDumperInterface
* @param DataDumperInterface|null $wrappedDumper A wrapped instance used whenever we failed contacting the server
* @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
*/
public function __construct(string $host, DataDumperInterface $wrappedDumper = null, array $contextProviders = array())
public function __construct(string $host, DataDumperInterface $wrappedDumper = null, array $contextProviders = [])
{
$this->connection = new Connection($host, $contextProviders);
$this->wrappedDumper = $wrappedDumper;

View File

@@ -2,8 +2,8 @@ VarDumper Component
===================
The VarDumper component provides mechanisms for walking through any arbitrary
PHP variable. Built on top, it provides a better `dump()` function that you
can use instead of `var_dump`.
PHP variable. It provides a better `dump()` function that you can use instead
of `var_dump`.
Resources
---------

0
vendor/symfony/var-dumper/Resources/bin/var-dump-server vendored Normal file → Executable file
View File

View File

@@ -29,7 +29,7 @@ class Connection
* @param string $host The server host
* @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
*/
public function __construct(string $host, array $contextProviders = array())
public function __construct(string $host, array $contextProviders = [])
{
if (false === strpos($host, '://')) {
$host = 'tcp://'.$host;
@@ -51,14 +51,14 @@ class Connection
return false;
}
$context = array('timestamp' => microtime(true));
$context = ['timestamp' => microtime(true)];
foreach ($this->contextProviders as $name => $provider) {
$context[$name] = $provider->getContext();
}
$context = array_filter($context);
$encodedPayload = base64_encode(serialize(array($data, $context)))."\n";
$encodedPayload = base64_encode(serialize([$data, $context]))."\n";
set_error_handler(array(self::class, 'nullErrorHandler'));
set_error_handler([self::class, 'nullErrorHandler']);
try {
if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {
return true;
@@ -85,13 +85,11 @@ class Connection
private function createSocket()
{
set_error_handler(array(self::class, 'nullErrorHandler'));
set_error_handler([self::class, 'nullErrorHandler']);
try {
return stream_socket_client($this->host, $errno, $errstr, 3, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
} finally {
restore_error_handler();
}
return $socket;
}
}

View File

@@ -52,12 +52,12 @@ class DumpServer
}
foreach ($this->getMessages() as $clientId => $message) {
$payload = @unserialize(base64_decode($message), array('allowed_classes' => array(Data::class, Stub::class)));
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);
// Impossible to decode the message, give up.
if (false === $payload) {
if ($this->logger) {
$this->logger->warning('Unable to decode a message from {clientId} client.', array('clientId' => $clientId));
$this->logger->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);
}
continue;
@@ -65,7 +65,7 @@ class DumpServer
if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) {
if ($this->logger) {
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', array('clientId' => $clientId));
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);
}
continue;
@@ -84,8 +84,8 @@ class DumpServer
private function getMessages(): iterable
{
$sockets = array((int) $this->socket => $this->socket);
$write = array();
$sockets = [(int) $this->socket => $this->socket];
$write = [];
while (true) {
$read = $sockets;

View File

@@ -22,7 +22,7 @@ class CasterTest extends TestCase
{
use VarDumperTestTrait;
private $referenceArray = array(
private $referenceArray = [
'null' => null,
'empty' => false,
'public' => 'pub',
@@ -30,7 +30,7 @@ class CasterTest extends TestCase
"\0+\0dynamic" => 'dyn',
"\0*\0protected" => 'prot',
"\0Foo\0private" => 'priv',
);
];
/**
* @dataProvider provideFilter
@@ -48,107 +48,107 @@ class CasterTest extends TestCase
public function provideFilter()
{
return array(
array(
return [
[
0,
array(),
),
array(
[],
],
[
Caster::EXCLUDE_PUBLIC,
array(
[
'null' => null,
'empty' => false,
'public' => 'pub',
),
),
array(
],
],
[
Caster::EXCLUDE_NULL,
array(
[
'null' => null,
),
),
array(
],
],
[
Caster::EXCLUDE_EMPTY,
array(
[
'null' => null,
'empty' => false,
),
),
array(
],
],
[
Caster::EXCLUDE_VIRTUAL,
array(
[
"\0~\0virtual" => 'virt',
),
),
array(
],
],
[
Caster::EXCLUDE_DYNAMIC,
array(
[
"\0+\0dynamic" => 'dyn',
),
),
array(
],
],
[
Caster::EXCLUDE_PROTECTED,
array(
[
"\0*\0protected" => 'prot',
),
),
array(
],
],
[
Caster::EXCLUDE_PRIVATE,
array(
[
"\0Foo\0private" => 'priv',
),
),
array(
],
],
[
Caster::EXCLUDE_VERBOSE,
array(
[
'public' => 'pub',
"\0*\0protected" => 'prot',
),
array('public', "\0*\0protected"),
),
array(
],
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_NOT_IMPORTANT,
array(
[
'null' => null,
'empty' => false,
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
"\0Foo\0private" => 'priv',
),
array('public', "\0*\0protected"),
),
array(
],
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC,
array(
[
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
),
),
array(
],
],
[
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
$this->referenceArray,
array('public', "\0*\0protected"),
),
array(
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY,
array(
[
'null' => null,
'empty' => false,
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
"\0*\0protected" => 'prot',
"\0Foo\0private" => 'priv',
),
array('public', 'empty'),
),
array(
],
['public', 'empty'],
],
[
Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT,
array(
[
'empty' => false,
),
array('public', 'empty'),
),
);
],
['public', 'empty'],
],
];
}
public function testAnonymousClass()

View File

@@ -47,7 +47,7 @@ EODUMP;
{
$stub = new Stub();
$date = new \DateTime($time, new \DateTimeZone($timezone));
$cast = DateCaster::castDateTime($date, array('foo' => 'bar'), $stub, false, 0);
$cast = DateCaster::castDateTime($date, ['foo' => 'bar'], $stub, false, 0);
$xDump = <<<EODUMP
array:1 [
@@ -75,18 +75,18 @@ EODUMP;
public function provideDateTimes()
{
return array(
array('2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'),
array('2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'),
array('2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'),
return [
['2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'],
['2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'],
['2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'],
array('2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
);
['2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
];
}
/**
@@ -141,7 +141,7 @@ EODUMP;
$interval = $this->createInterval($intervalSpec, $ms, $invert);
$stub = new Stub();
$cast = DateCaster::castInterval($interval, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
$cast = DateCaster::castInterval($interval, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE);
$xDump = <<<EODUMP
array:1 [
@@ -173,35 +173,35 @@ EODUMP;
public function provideIntervals()
{
return array(
array('PT0S', 0, 0, '0s', '0s'),
array('PT0S', 0.1, 0, '+ 00:00:00.100', '%is'),
array('PT1S', 0, 0, '+ 00:00:01.0', '%is'),
array('PT2M', 0, 0, '+ 00:02:00.0', '%is'),
array('PT3H', 0, 0, '+ 03:00:00.0', '%ss'),
array('P4D', 0, 0, '+ 4d', '%ss'),
array('P5M', 0, 0, '+ 5m', null),
array('P6Y', 0, 0, '+ 6y', null),
array('P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null),
array('PT1M60S', 0, 0, '+ 00:02:00.0', null),
array('PT1H60M', 0, 0, '+ 02:00:00.0', null),
array('P1DT24H', 0, 0, '+ 2d', null),
array('P1M32D', 0, 0, '+ 1m 32d', null),
return [
['PT0S', 0, 0, '0s', '0s'],
['PT0S', 0.1, 0, '+ 00:00:00.100', '%is'],
['PT1S', 0, 0, '+ 00:00:01.0', '%is'],
['PT2M', 0, 0, '+ 00:02:00.0', '%is'],
['PT3H', 0, 0, '+ 03:00:00.0', '%ss'],
['P4D', 0, 0, '+ 4d', '%ss'],
['P5M', 0, 0, '+ 5m', null],
['P6Y', 0, 0, '+ 6y', null],
['P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null],
['PT1M60S', 0, 0, '+ 00:02:00.0', null],
['PT1H60M', 0, 0, '+ 02:00:00.0', null],
['P1DT24H', 0, 0, '+ 2d', null],
['P1M32D', 0, 0, '+ 1m 32d', null],
array('PT0S', 0, 1, '0s', '0s'),
array('PT0S', 0.1, 1, '- 00:00:00.100', '%is'),
array('PT1S', 0, 1, '- 00:00:01.0', '%is'),
array('PT2M', 0, 1, '- 00:02:00.0', '%is'),
array('PT3H', 0, 1, '- 03:00:00.0', '%ss'),
array('P4D', 0, 1, '- 4d', '%ss'),
array('P5M', 0, 1, '- 5m', null),
array('P6Y', 0, 1, '- 6y', null),
array('P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null),
array('PT1M60S', 0, 1, '- 00:02:00.0', null),
array('PT1H60M', 0, 1, '- 02:00:00.0', null),
array('P1DT24H', 0, 1, '- 2d', null),
array('P1M32D', 0, 1, '- 1m 32d', null),
);
['PT0S', 0, 1, '0s', '0s'],
['PT0S', 0.1, 1, '- 00:00:00.100', '%is'],
['PT1S', 0, 1, '- 00:00:01.0', '%is'],
['PT2M', 0, 1, '- 00:02:00.0', '%is'],
['PT3H', 0, 1, '- 03:00:00.0', '%ss'],
['P4D', 0, 1, '- 4d', '%ss'],
['P5M', 0, 1, '- 5m', null],
['P6Y', 0, 1, '- 6y', null],
['P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null],
['PT1M60S', 0, 1, '- 00:02:00.0', null],
['PT1H60M', 0, 1, '- 02:00:00.0', null],
['P1DT24H', 0, 1, '- 2d', null],
['P1M32D', 0, 1, '- 1m 32d', null],
];
}
/**
@@ -244,7 +244,7 @@ EODUMP;
$timezone = new \DateTimeZone($timezone);
$stub = new Stub();
$cast = DateCaster::castTimeZone($timezone, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
$cast = DateCaster::castTimeZone($timezone, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE);
$xDump = <<<EODUMP
array:1 [
@@ -274,27 +274,27 @@ EODUMP;
{
$xRegion = \extension_loaded('intl') ? '%s' : '';
return array(
return [
// type 1 (UTC offset)
array('-12:00', '-12:00', ''),
array('+00:00', '+00:00', ''),
array('+14:00', '+14:00', ''),
['-12:00', '-12:00', ''],
['+00:00', '+00:00', ''],
['+14:00', '+14:00', ''],
// type 2 (timezone abbreviation)
array('GMT', '+00:00', ''),
array('a', '+01:00', ''),
array('b', '+02:00', ''),
array('z', '+00:00', ''),
['GMT', '+00:00', ''],
['a', '+01:00', ''],
['b', '+02:00', ''],
['z', '+00:00', ''],
// type 3 (timezone identifier)
array('Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion),
array('America/Panama', 'America/Panama (%s:00)', $xRegion),
array('Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion),
array('Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion),
array('Australia/Perth', 'Australia/Perth (%s:00)', $xRegion),
array('Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion),
array('Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion),
);
['Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion],
['America/Panama', 'America/Panama (%s:00)', $xRegion],
['Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion],
['Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion],
['Australia/Perth', 'Australia/Perth (%s:00)', $xRegion],
['Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion],
['Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion],
];
}
/**
@@ -321,7 +321,7 @@ EODUMP;
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options);
$stub = new Stub();
$cast = DateCaster::castPeriod($p, array(), $stub, false, 0);
$cast = DateCaster::castPeriod($p, [], $stub, false, 0);
$xDump = <<<EODUMP
array:1 [
@@ -349,28 +349,28 @@ EODUMP;
public function providePeriods()
{
$periods = array(
array('2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'),
array('2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'),
$periods = [
['2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'],
['2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'],
array('2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
array('2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
['2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'],
['2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'],
array('2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'),
array('2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'),
['2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'],
['2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'],
array('2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'),
array('2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'),
['2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'],
['2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'],
array('2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
array('2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
['2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'],
['2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'],
array('2017-01-01', 'P1DT1H', '2017-01-03', 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
array('2017-01-01', 'P1DT1H', 1, 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
['2017-01-01', 'P1DT1H', '2017-01-03', 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'],
['2017-01-01', 'P1DT1H', 1, 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'],
array('2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'),
array('2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'),
);
['2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'],
['2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'],
];
if (\PHP_VERSION_ID < 70107) {
array_walk($periods, function (&$i) { $i[5] = ''; });

View File

@@ -36,7 +36,7 @@ class ExceptionCasterTest extends TestCase
public function testDefaultSettings()
{
$ref = array('foo');
$ref = ['foo'];
$e = $this->getTestException('foo', $ref);
$expectedDump = <<<'EODUMP'
@@ -57,7 +57,7 @@ Exception {
EODUMP;
$this->assertDumpMatchesFormat($expectedDump, $e);
$this->assertSame(array('foo'), $ref);
$this->assertSame(['foo'], $ref);
}
public function testSeek()
@@ -166,19 +166,19 @@ EODUMP;
{
require_once \dirname(__DIR__).'/Fixtures/Twig.php';
$f = array(
new FrameStub(array(
$f = [
new FrameStub([
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 20,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
)),
new FrameStub(array(
]),
new FrameStub([
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 21,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),
)),
);
]),
];
$expectedDump = <<<'EODUMP'
array:2 [

View File

@@ -33,9 +33,9 @@ array:1 [
"\\x00~\\x00value" => %s
]
EODUMP;
$this->assertDumpEquals(sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpOctal), GmpCaster::castGmp($gmpOctal, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmp), GmpCaster::castGmp($gmp, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, [], new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpOctal), GmpCaster::castGmp($gmpOctal, [], new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmp), GmpCaster::castGmp($gmp, [], new Stub(), false, 0));
$dump = <<<EODUMP
GMP {

View File

@@ -54,12 +54,12 @@ EOTXT;
$expectedAttribute11 = $var->getAttribute(\NumberFormatter::GROUPING_SIZE);
$expectedAttribute12 = $var->getAttribute(\NumberFormatter::ROUNDING_MODE);
$expectedAttribute13 = number_format($var->getAttribute(\NumberFormatter::ROUNDING_INCREMENT), 1);
$expectedAttribute14 = $var->getAttribute(\NumberFormatter::FORMAT_WIDTH);
$expectedAttribute14 = $this->getDump($var->getAttribute(\NumberFormatter::FORMAT_WIDTH));
$expectedAttribute15 = $var->getAttribute(\NumberFormatter::PADDING_POSITION);
$expectedAttribute16 = $var->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE);
$expectedAttribute17 = $var->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED);
$expectedAttribute18 = $var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS);
$expectedAttribute19 = $var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS);
$expectedAttribute18 = $this->getDump($var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS));
$expectedAttribute19 = $this->getDump($var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS));
$expectedAttribute20 = $var->getAttribute(\NumberFormatter::LENIENT_PARSE);
$expectedTextAttribute1 = $var->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX);

View File

@@ -29,9 +29,9 @@ class PdoCasterTest extends TestCase
public function testCastPdo()
{
$pdo = new \PDO('sqlite::memory:');
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, ['PDOStatement', [$pdo]]);
$cast = PdoCaster::castPdo($pdo, array(), new Stub(), false);
$cast = PdoCaster::castPdo($pdo, [], new Stub(), false);
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);

View File

@@ -37,7 +37,7 @@ ReflectionClass {
%A]
constants: array:3 [
"IS_IMPLICIT_ABSTRACT" => 16
"IS_EXPLICIT_ABSTRACT" => 32
"IS_EXPLICIT_ABSTRACT" => %d
"IS_FINAL" => %d
]
properties: array:%d [
@@ -90,10 +90,10 @@ EOTXT
if (\defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('Not for HHVM.');
}
$var = array(
$var = [
(new \ReflectionMethod($this, __FUNCTION__))->getClosure($this),
(new \ReflectionMethod(__CLASS__, 'tearDownAfterClass'))->getClosure(),
);
];
$this->assertDumpMatchesFormat(
<<<EOTXT
@@ -235,7 +235,7 @@ array:2 [
EODUMP;
$r = new \ReflectionGenerator($generator);
$this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator()));
$this->assertDumpMatchesFormat($expectedDump, [$r, $r->getExecutingGenerator()]);
foreach ($generator as $v) {
}

View File

@@ -23,8 +23,8 @@ class SplCasterTest extends TestCase
public function getCastFileInfoTests()
{
return array(
array(__FILE__, <<<'EOTXT'
return [
[__FILE__, <<<'EOTXT'
SplFileInfo {
%Apath: "%sCaster"
filename: "SplCasterTest.php"
@@ -49,8 +49,8 @@ SplFileInfo {
link: false
%A}
EOTXT
),
array('https://google.com/about', <<<'EOTXT'
],
['https://google.com/about', <<<'EOTXT'
SplFileInfo {
%Apath: "https://google.com"
filename: "about"
@@ -60,8 +60,8 @@ SplFileInfo {
realPath: false
%A}
EOTXT
),
);
],
];
}
/** @dataProvider getCastFileInfoTests */
@@ -137,12 +137,12 @@ EOTXT;
public function provideCastSplDoublyLinkedList()
{
return array(
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
);
return [
[\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'],
[\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'],
[\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'],
[\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'],
];
}
public function testCastObjectStorageIsntModified()
@@ -166,7 +166,7 @@ EOTXT;
public function testCastArrayObject()
{
$var = new \ArrayObject(array(123));
$var = new \ArrayObject([123]);
$var->foo = 234;
$expected = <<<EOTXT
@@ -185,7 +185,7 @@ EOTXT;
public function testArrayIterator()
{
$var = new MyArrayIterator(array(234));
$var = new MyArrayIterator([234]);
$expected = <<<EOTXT
Symfony\Component\VarDumper\Tests\Caster\MyArrayIterator {

View File

@@ -26,7 +26,7 @@ class StubCasterTest extends TestCase
public function testArgsStubWithDefaults($foo = 234, $bar = 456)
{
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -41,7 +41,7 @@ EODUMP;
public function testArgsStubWithExtraArgs($foo = 234)
{
$args = array(new ArgsStub(array(123, 456), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123, 456], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -59,7 +59,7 @@ EODUMP;
public function testArgsStubNoParamWithExtraArgs()
{
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -74,7 +74,7 @@ EODUMP;
public function testArgsStubWithClosure()
{
$args = array(new ArgsStub(array(123), '{closure}', null));
$args = [new ArgsStub([123], '{closure}', null)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -89,13 +89,13 @@ EODUMP;
public function testLinkStub()
{
$var = array(new LinkStub(__CLASS__, 0, __FILE__));
$var = [new LinkStub(__CLASS__, 0, __FILE__)];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
$dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']);
$dump = $dumper->dump($cloner->cloneVar($var), true);
$expectedDump = <<<'EODUMP'
@@ -110,13 +110,13 @@ EODUMP;
public function testLinkStubWithNoFileLink()
{
$var = array(new LinkStub('example.com', 0, 'http://example.com'));
$var = [new LinkStub('example.com', 0, 'http://example.com')];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
$dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']);
$dump = $dumper->dump($cloner->cloneVar($var), true);
$expectedDump = <<<'EODUMP'
@@ -131,13 +131,13 @@ EODUMP;
public function testClassStub()
{
$var = array(new ClassStub('hello', array(FooInterface::class, 'foo')));
$var = [new ClassStub('hello', [FooInterface::class, 'foo'])];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
@@ -151,7 +151,7 @@ EODUMP;
public function testClassStubWithNotExistingClass()
{
$var = array(new ClassStub(NotExisting::class));
$var = [new ClassStub(NotExisting::class)];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
@@ -172,13 +172,13 @@ EODUMP;
public function testClassStubWithNotExistingMethod()
{
$var = array(new ClassStub('hello', array(FooInterface::class, 'missing')));
$var = [new ClassStub('hello', [FooInterface::class, 'missing'])];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
@@ -192,14 +192,14 @@ EODUMP;
public function testClassStubWithAnonymousClass()
{
$var = array(new ClassStub(\get_class(new class() extends \Exception {
})));
$var = [new ClassStub(\get_class(new class() extends \Exception {
}))];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>

View File

@@ -66,15 +66,15 @@ EODUMP;
public function provideNodes()
{
return array(
array(0, <<<'EODUMP'
return [
[0, <<<'EODUMP'
XMLReader {
+nodeType: NONE
…13
}
EODUMP
),
array(1, <<<'EODUMP'
],
[1, <<<'EODUMP'
XMLReader {
+localName: "foo"
+nodeType: ELEMENT
@@ -82,8 +82,8 @@ XMLReader {
…11
}
EODUMP
),
array(2, <<<'EODUMP'
],
[2, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -96,8 +96,8 @@ XMLReader {
…9
}
EODUMP
),
array(3, <<<'EODUMP'
],
[3, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -106,8 +106,8 @@ XMLReader {
…10
}
EODUMP
),
array(4, <<<'EODUMP'
],
[4, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: END_ELEMENT
@@ -116,8 +116,8 @@ XMLReader {
…10
}
EODUMP
),
array(6, <<<'EODUMP'
],
[6, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -127,8 +127,8 @@ XMLReader {
…9
}
EODUMP
),
array(9, <<<'EODUMP'
],
[9, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: TEXT
@@ -138,8 +138,8 @@ XMLReader {
…9
}
EODUMP
),
array(12, <<<'EODUMP'
],
[12, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -149,8 +149,8 @@ XMLReader {
…9
}
EODUMP
),
array(13, <<<'EODUMP'
],
[13, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: END_ELEMENT
@@ -159,8 +159,8 @@ XMLReader {
…10
}
EODUMP
),
array(15, <<<'EODUMP'
],
[15, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -170,8 +170,8 @@ XMLReader {
…9
}
EODUMP
),
array(16, <<<'EODUMP'
],
[16, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -184,8 +184,8 @@ XMLReader {
…9
}
EODUMP
),
array(17, <<<'EODUMP'
],
[17, <<<'EODUMP'
XMLReader {
+localName: "baz"
+prefix: "baz"
@@ -196,8 +196,8 @@ XMLReader {
…8
}
EODUMP
),
array(18, <<<'EODUMP'
],
[18, <<<'EODUMP'
XMLReader {
+localName: "baz"
+prefix: "baz"
@@ -208,8 +208,8 @@ XMLReader {
…8
}
EODUMP
),
array(19, <<<'EODUMP'
],
[19, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -222,8 +222,8 @@ XMLReader {
…9
}
EODUMP
),
array(21, <<<'EODUMP'
],
[21, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -233,8 +233,8 @@ XMLReader {
…9
}
EODUMP
),
array(22, <<<'EODUMP'
],
[22, <<<'EODUMP'
XMLReader {
+localName: "foo"
+nodeType: END_ELEMENT
@@ -242,7 +242,7 @@ XMLReader {
…11
}
EODUMP
),
);
],
];
}
}

View File

@@ -21,9 +21,9 @@ class DataTest extends TestCase
{
public function testBasicData()
{
$values = array(1 => 123, 4.5, 'abc', null, false);
$values = [1 => 123, 4.5, 'abc', null, false];
$data = $this->cloneVar($values);
$clonedValues = array();
$clonedValues = [];
$this->assertInstanceOf(Data::class, $data);
$this->assertCount(\count($values), $data);
@@ -62,7 +62,7 @@ class DataTest extends TestCase
public function testArray()
{
$values = array(array(), array(123));
$values = [[], [123]];
$data = $this->cloneVar($values);
$this->assertSame($values, $data->getValue(true));
@@ -83,7 +83,7 @@ class DataTest extends TestCase
public function testStub()
{
$data = $this->cloneVar(array(new ClassStub('stdClass')));
$data = $this->cloneVar([new ClassStub('stdClass')]);
$data = $data[0];
$this->assertSame('string', $data->getType());
@@ -93,15 +93,15 @@ class DataTest extends TestCase
public function testHardRefs()
{
$values = array(array());
$values = [[]];
$values[1] = &$values[0];
$values[2][0] = &$values[2];
$data = $this->cloneVar($values);
$this->assertSame(array(), $data[0]->getValue());
$this->assertSame(array(), $data[1]->getValue());
$this->assertEquals(array($data[2]->getValue()), $data[2]->getValue(true));
$this->assertSame([], $data[0]->getValue());
$this->assertSame([], $data[1]->getValue());
$this->assertEquals([$data[2]->getValue()], $data[2]->getValue(true));
$this->assertSame('array (count=3)', (string) $data);
}

View File

@@ -21,7 +21,7 @@ class VarClonerTest extends TestCase
{
public function testMaxIntBoundary()
{
$data = array(PHP_INT_MAX => 123);
$data = [PHP_INT_MAX => 123];
$cloner = new VarCloner();
$clone = $cloner->cloneVar($data);
@@ -149,42 +149,42 @@ EOTXT;
public function testLimits()
{
// Level 0:
$data = array(
$data = [
// Level 1:
array(
[
// Level 2:
array(
[
// Level 3:
'Level 3 Item 0',
'Level 3 Item 1',
'Level 3 Item 2',
'Level 3 Item 3',
),
array(
],
[
'Level 3 Item 4',
'Level 3 Item 5',
'Level 3 Item 6',
),
array(
],
[
'Level 3 Item 7',
),
),
array(
array(
],
],
[
[
'Level 3 Item 8',
),
],
'Level 2 Item 0',
),
array(
],
[
'Level 2 Item 1',
),
],
'Level 1 Item 0',
array(
[
// Test setMaxString:
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'SHORT',
),
);
],
];
$cloner = new VarCloner();
$cloner->setMinDepth(2);
@@ -381,16 +381,16 @@ EOTXT;
public function testCaster()
{
$cloner = new VarCloner(array(
$cloner = new VarCloner([
'*' => function ($obj, $array) {
return array('foo' => 123);
return ['foo' => 123];
},
__CLASS__ => function ($obj, $array) {
++$array['foo'];
return $array;
},
));
]);
$clone = $cloner->cloneVar($this);
$expected = <<<EOTXT

View File

@@ -42,21 +42,21 @@ class CliDescriptorTest extends TestCase
return $s;
}));
$descriptor->describe($output, new Data(array(array(123))), $context + array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat(trim($expectedOutput), str_replace(PHP_EOL, "\n", trim($output->fetch())));
}
public function provideContext()
{
yield 'source' => array(
array(
'source' => array(
yield 'source' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
),
),
],
],
<<<TXT
Received from client #1
-----------------------
@@ -67,18 +67,18 @@ Received from client #1
file /Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
-------- ---------------------------------------------------------------------------------------------------
TXT
);
];
yield 'source full' => array(
array(
'source' => array(
yield 'source full' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
),
),
],
],
<<<TXT
Received from client #1
-----------------------
@@ -92,15 +92,15 @@ Received from client #1
Open source in your IDE/browser:
phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30
TXT
);
];
yield 'cli' => array(
array(
'cli' => array(
yield 'cli' => [
[
'cli' => [
'identifier' => 'd8bece1c',
'command_line' => 'bin/phpunit',
),
),
],
],
<<<TXT
$ bin/phpunit
-------------
@@ -109,17 +109,17 @@ $ bin/phpunit
date Fri, 14 Dec 2018 16:17:48 +0000
------ ---------------------------------
TXT
);
];
yield 'request' => array(
array(
'request' => array(
yield 'request' => [
[
'request' => [
'identifier' => 'd8bece1c',
'controller' => new Data(array(array('FooController.php'))),
'controller' => new Data([['FooController.php']]),
'method' => 'GET',
'uri' => 'http://localhost/foo',
),
),
],
],
<<<TXT
GET http://localhost/foo
------------------------
@@ -129,6 +129,6 @@ GET http://localhost/foo
controller "FooController.php"
------------ ---------------------------------
TXT
);
];
}
}

View File

@@ -39,11 +39,11 @@ class HtmlDescriptorTest extends TestCase
$dumper->method('dump')->willReturn('[DUMPED]');
$descriptor = new HtmlDescriptor($dumper);
$descriptor->describe($output, new Data(array(array(123))), array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat('<style>%A</style><script>%A</script>%A', $output->fetch(), 'styles & scripts are output');
$descriptor->describe($output, new Data(array(array(123))), array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1);
$this->assertStringNotMatchesFormat('<style>%A</style><script>%A</script>%A', $output->fetch(), 'styles & scripts are output only once');
}
@@ -58,21 +58,21 @@ class HtmlDescriptorTest extends TestCase
$dumper->method('dump')->willReturn('[DUMPED]');
$descriptor = new HtmlDescriptor($dumper);
$descriptor->describe($output, new Data(array(array(123))), $context + array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat(trim($expectedOutput), trim(preg_replace('@<style>.*</style><script>.*</script>@s', '', $output->fetch())));
}
public function provideContext()
{
yield 'source' => array(
array(
'source' => array(
yield 'source' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
),
),
],
],
<<<TXT
<article data-dedup-id="%s">
<header>
@@ -92,19 +92,19 @@ class HtmlDescriptorTest extends TestCase
</section>
</article>
TXT
);
];
yield 'source full' => array(
array(
'source' => array(
yield 'source full' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'project_dir' => 'src/Symfony/',
'line' => 30,
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
),
),
],
],
<<<TXT
<article data-dedup-id="%s">
<header>
@@ -128,15 +128,15 @@ TXT
</section>
</article>
TXT
);
];
yield 'cli' => array(
array(
'cli' => array(
yield 'cli' => [
[
'cli' => [
'identifier' => 'd8bece1c',
'command_line' => 'bin/phpunit',
),
),
],
],
<<<TXT
<article data-dedup-id="d8bece1c">
<header>
@@ -156,17 +156,17 @@ TXT
</section>
</article>
TXT
);
];
yield 'request' => array(
array(
'request' => array(
yield 'request' => [
[
'request' => [
'identifier' => 'd8bece1c',
'controller' => new Data(array(array('FooController.php'))),
'controller' => new Data([['FooController.php']]),
'method' => 'GET',
'uri' => 'http://localhost/foo',
),
),
],
],
<<<TXT
<article data-dedup-id="d8bece1c">
<header>
@@ -190,6 +190,6 @@ TXT
</section>
</article>
TXT
);
];
}
}

View File

@@ -32,13 +32,13 @@ class CliDumperTest extends TestCase
$dumper = new CliDumper('php://output');
$dumper->setColors(false);
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['uri'], $a['wrapper_data']);
return $a;
},
));
]);
$data = $cloner->cloneVar($var);
ob_start();
@@ -121,11 +121,11 @@ EOTXT
$dumper->setColors(false);
$cloner = new VarCloner();
$var = array(
'array' => array('a', 'b'),
$var = [
'array' => ['a', 'b'],
'string' => 'hello',
'multiline string' => "this\nis\na\multiline\nstring",
);
];
$dump = $dumper->dump($cloner->cloneVar($var), true);
@@ -181,7 +181,7 @@ array:3 [
EOTXT;
yield array($expected, CliDumper::DUMP_COMMA_SEPARATOR);
yield [$expected, CliDumper::DUMP_COMMA_SEPARATOR];
$expected = <<<'EOTXT'
array:3 [
@@ -200,7 +200,7 @@ array:3 [
EOTXT;
yield array($expected, CliDumper::DUMP_TRAILING_COMMA);
yield [$expected, CliDumper::DUMP_TRAILING_COMMA];
}
/**
@@ -263,7 +263,7 @@ EOTXT
public function testObjectCast()
{
$var = (object) array(1 => 1);
$var = (object) [1 => 1];
$var->{1} = 2;
if (\PHP_VERSION_ID >= 70200) {
@@ -320,10 +320,10 @@ EOTXT
putenv('DUMP_LIGHT_ARRAY=1');
putenv('DUMP_STRING_LENGTH=1');
$var = array(
$var = [
range(1, 3),
array('foo', 2 => 'bar'),
);
['foo', 2 => 'bar'],
];
$this->assertDumpEquals(
<<<EOTXT
@@ -360,22 +360,22 @@ EOTXT
$dumper = new CliDumper();
$dumper->setColors(false);
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['wrapper_data']);
return $a;
},
));
$cloner->addCasters(array(
]);
$cloner->addCasters([
':stream' => eval('return function () use ($twig) {
try {
$twig->render(array());
$twig->render([]);
} catch (\Twig\Error\RuntimeError $e) {
throw $e->getPrevious();
}
};'),
));
]);
$ref = (int) $out;
$data = $cloner->cloneVar($out);
@@ -416,7 +416,7 @@ EOTXT
public function testRefsInProperties()
{
$var = (object) array('foo' => 'foo');
$var = (object) ['foo' => 'foo'];
$var->bar = &$var->foo;
$dumper = new CliDumper();
@@ -530,12 +530,12 @@ EOTXT
}
$var = function &() {
$var = array();
$var = [];
$var[] = &$var;
return $var;
};
return array($var(), $GLOBALS, &$GLOBALS);
return [$var(), $GLOBALS, &$GLOBALS];
}
}

View File

@@ -43,7 +43,7 @@ class FunctionsTest extends TestCase
$return = dump($var1, $var2, $var3);
$out = ob_get_clean();
$this->assertEquals(array($var1, $var2, $var3), $return);
$this->assertEquals([$var1, $var2, $var3], $return);
}
protected function setupVarDumper()

View File

@@ -32,13 +32,13 @@ class HtmlDumperTest extends TestCase
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['uri'], $a['wrapper_data']);
return $a;
},
));
]);
$data = $cloner->cloneVar($var);
ob_start();

View File

@@ -44,14 +44,14 @@ class ServerDumperTest extends TestCase
$cloner = new VarCloner();
$data = $cloner->cloneVar('foo');
$dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper, array(
$dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper, [
'foo_provider' => new class() implements ContextProviderInterface {
public function getContext(): ?array
{
return array('foo');
return ['foo'];
}
},
));
]);
$dumped = null;
$process = $this->getServerProcess();
@@ -84,10 +84,10 @@ DUMP
private function getServerProcess(): Process
{
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, array(
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [
'COMPONENT_ROOT' => __DIR__.'/../../',
'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER,
));
]);
$process->inheritEnvironmentVariables(true);
return $process->setTimeout(9);

View File

@@ -11,11 +11,11 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
parent::__construct($env);
}
$this->parent = false;
$this->blocks = array();
$this->blocks = [];
$this->path = $path;
}
protected function doDisplay(array $context, array $blocks = array())
protected function doDisplay(array $context, array $blocks = [])
{
// line 2
throw new \Exception('Foobar');
@@ -28,7 +28,7 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
public function getDebugInfo()
{
return array(20 => 1, 21 => 2);
return [20 => 1, 21 => 2];
}
public function getSourceContext()

View File

@@ -14,19 +14,19 @@ $foo->bar = 'bar';
$g = fopen(__FILE__, 'r');
$var = array(
$var = [
'number' => 1, null,
'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX,
'str' => "déjà\n", "\xE9\x00test\t\ning",
'[]' => array(),
'[]' => [],
'res' => $g,
'obj' => $foo,
'closure' => function ($a, \PDO &$b = null) {},
'line' => __LINE__ - 1,
'nobj' => array((object) array()),
);
'nobj' => [(object) []],
];
$r = array();
$r = [];
$r[] = &$r;
$var['recurs'] = &$r;

View File

@@ -26,14 +26,14 @@ class ConnectionTest extends TestCase
{
$cloner = new VarCloner();
$data = $cloner->cloneVar('foo');
$connection = new Connection(self::VAR_DUMPER_SERVER, array(
$connection = new Connection(self::VAR_DUMPER_SERVER, [
'foo_provider' => new class() implements ContextProviderInterface {
public function getContext(): ?array
{
return array('foo');
return ['foo'];
}
},
));
]);
$dumped = null;
$process = $this->getServerProcess();
@@ -77,10 +77,10 @@ DUMP
private function getServerProcess(): Process
{
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, array(
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [
'COMPONENT_ROOT' => __DIR__.'/../../',
'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER,
));
]);
$process->inheritEnvironmentVariables(true);
return $process->setTimeout(9);

View File

@@ -21,7 +21,7 @@ class VarDumperTestTraitTest extends TestCase
public function testItComparesLargeData()
{
$howMany = 700;
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
$data = array_fill_keys(range(0, $howMany), ['a', 'b', 'c', 'd']);
$expected = sprintf("array:%d [\n", $howMany + 1);
for ($i = 0; $i <= $howMany; ++$i) {
@@ -41,6 +41,6 @@ EODUMP;
public function testAllowsNonScalarExpectation()
{
$this->assertDumpEquals(new \ArrayObject(array('bim' => 'bam')), new \ArrayObject(array('bim' => 'bam')));
$this->assertDumpEquals(new \ArrayObject(['bim' => 'bam']), new \ArrayObject(['bim' => 'bam']));
}
}

View File

@@ -33,7 +33,7 @@ class VarDumper
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
$dumper = 'html' === $_SERVER['VAR_DUMPER_FORMAT'] ? new HtmlDumper() : new CliDumper();
} else {
$dumper = \in_array(\PHP_SAPI, array('cli', 'phpdbg')) ? new CliDumper() : new HtmlDumper();
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper() : new HtmlDumper();
}
self::$handler = function ($var) use ($cloner, $dumper) {