updated-packages
This commit is contained in:
@@ -21,10 +21,10 @@ use Symfony\Component\VarDumper\Cloner\DumperInterface;
|
||||
*/
|
||||
abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
{
|
||||
const DUMP_LIGHT_ARRAY = 1;
|
||||
const DUMP_STRING_LENGTH = 2;
|
||||
const DUMP_COMMA_SEPARATOR = 4;
|
||||
const DUMP_TRAILING_COMMA = 8;
|
||||
public const DUMP_LIGHT_ARRAY = 1;
|
||||
public const DUMP_STRING_LENGTH = 2;
|
||||
public const DUMP_COMMA_SEPARATOR = 4;
|
||||
public const DUMP_TRAILING_COMMA = 8;
|
||||
|
||||
public static $defaultOutput = 'php://output';
|
||||
|
||||
@@ -35,19 +35,18 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
protected $indentPad = ' ';
|
||||
protected $flags;
|
||||
|
||||
private $charset;
|
||||
private $charset = '';
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
$this->flags = $flags;
|
||||
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
|
||||
$this->decimalPoint = localeconv();
|
||||
$this->decimalPoint = $this->decimalPoint['decimal_point'];
|
||||
$this->setCharset($charset ?: \ini_get('php.output_encoding') ?: \ini_get('default_charset') ?: 'UTF-8');
|
||||
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
|
||||
$this->setOutput($output ?: static::$defaultOutput);
|
||||
if (!$output && \is_string(static::$defaultOutput)) {
|
||||
static::$defaultOutput = $this->outputStream;
|
||||
@@ -63,17 +62,17 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
*/
|
||||
public function setOutput($output)
|
||||
{
|
||||
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
|
||||
$prev = $this->outputStream ?? $this->lineDumper;
|
||||
|
||||
if (\is_callable($output)) {
|
||||
$this->outputStream = null;
|
||||
$this->lineDumper = $output;
|
||||
} else {
|
||||
if (\is_string($output)) {
|
||||
$output = fopen($output, 'wb');
|
||||
$output = fopen($output, 'w');
|
||||
}
|
||||
$this->outputStream = $output;
|
||||
$this->lineDumper = array($this, 'echoLine');
|
||||
$this->lineDumper = [$this, 'echoLine'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
@@ -116,22 +115,20 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
/**
|
||||
* Dumps a Data object.
|
||||
*
|
||||
* @param Data $data A Data object
|
||||
* @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump
|
||||
*
|
||||
* @return string|null The dump as string when $output is true
|
||||
*/
|
||||
public function dump(Data $data, $output = null)
|
||||
{
|
||||
$this->decimalPoint = localeconv();
|
||||
$this->decimalPoint = $this->decimalPoint['decimal_point'];
|
||||
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
|
||||
|
||||
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) {
|
||||
setlocale(LC_NUMERIC, 'C');
|
||||
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
|
||||
setlocale(\LC_NUMERIC, 'C');
|
||||
}
|
||||
|
||||
if ($returnDump = true === $output) {
|
||||
$output = fopen('php://memory', 'r+b');
|
||||
$output = fopen('php://memory', 'r+');
|
||||
}
|
||||
if ($output) {
|
||||
$prevOutput = $this->setOutput($output);
|
||||
@@ -151,9 +148,11 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
$this->setOutput($prevOutput);
|
||||
}
|
||||
if ($locale) {
|
||||
setlocale(LC_NUMERIC, $locale);
|
||||
setlocale(\LC_NUMERIC, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +163,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
*/
|
||||
protected function dumpLine($depth)
|
||||
{
|
||||
\call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad);
|
||||
($this->lineDumper)($this->line, $depth, $this->indentPad);
|
||||
$this->line = '';
|
||||
}
|
||||
|
||||
@@ -185,13 +184,13 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
/**
|
||||
* Converts a non-UTF-8 string to UTF-8.
|
||||
*
|
||||
* @param string $s The non-UTF-8 string to convert
|
||||
* @param string|null $s The non-UTF-8 string to convert
|
||||
*
|
||||
* @return string The string converted to UTF-8
|
||||
* @return string|null The string converted to UTF-8
|
||||
*/
|
||||
protected function utf8Encode($s)
|
||||
{
|
||||
if (preg_match('//u', $s)) {
|
||||
if (null === $s || preg_match('//u', $s)) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
152
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
152
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
@@ -26,9 +26,9 @@ 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',
|
||||
'default' => '0;38;5;208',
|
||||
'num' => '1;38;5;38',
|
||||
'const' => '1;38;5;208',
|
||||
'str' => '1;38;5;113',
|
||||
@@ -40,21 +40,27 @@ 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;
|
||||
|
||||
private $displayOptions = [
|
||||
'fileLinkFormat' => null,
|
||||
];
|
||||
|
||||
private $handlesHrefGracefully;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -64,7 +70,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,8 +80,10 @@ class CliDumper extends AbstractDumper
|
||||
'meta' => '35',
|
||||
'key' => '32',
|
||||
'index' => '34',
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,6 +116,16 @@ class CliDumper extends AbstractDumper
|
||||
$this->styles = $styles + $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures display options.
|
||||
*
|
||||
* @param array $displayOptions A map of display options to customize the behavior
|
||||
*/
|
||||
public function setDisplayOptions(array $displayOptions)
|
||||
{
|
||||
$this->displayOptions = $displayOptions + $this->displayOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -131,12 +149,12 @@ class CliDumper extends AbstractDumper
|
||||
$style = 'num';
|
||||
|
||||
switch (true) {
|
||||
case INF === $value: $value = 'INF'; break;
|
||||
case -INF === $value: $value = '-INF'; break;
|
||||
case \INF === $value: $value = 'INF'; break;
|
||||
case -\INF === $value: $value = '-INF'; break;
|
||||
case is_nan($value): $value = 'NAN'; break;
|
||||
default:
|
||||
$value = (string) $value;
|
||||
if (false === strpos($value, $this->decimalPoint)) {
|
||||
if (!str_contains($value, $this->decimalPoint)) {
|
||||
$value .= $this->decimalPoint.'0';
|
||||
}
|
||||
break;
|
||||
@@ -152,7 +170,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 +195,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]);
|
||||
@@ -255,7 +273,12 @@ class CliDumper extends AbstractDumper
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
{
|
||||
if (null === $this->colors) {
|
||||
$this->colors = $this->supportsColors();
|
||||
}
|
||||
|
||||
$this->dumpKey($cursor);
|
||||
$attr = $cursor->attr;
|
||||
|
||||
if ($this->collapseNextHash) {
|
||||
$cursor->skipChildren = true;
|
||||
@@ -264,17 +287,17 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
$class = $this->utf8Encode($class);
|
||||
if (Cursor::HASH_OBJECT === $type) {
|
||||
$prefix = $class && 'stdClass' !== $class ? $this->style('note', $class).' {' : '{';
|
||||
$prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr).(empty($attr['cut_hash']) ? ' {' : '') : '{';
|
||||
} elseif (Cursor::HASH_RESOURCE === $type) {
|
||||
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
|
||||
$prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' ');
|
||||
} else {
|
||||
$prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '[';
|
||||
}
|
||||
|
||||
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));
|
||||
if (($cursor->softRefCount || 0 < $cursor->softRefHandle) && empty($attr['cut_hash'])) {
|
||||
$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);
|
||||
}
|
||||
@@ -291,17 +314,19 @@ class CliDumper extends AbstractDumper
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
|
||||
{
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
|
||||
if (empty($cursor->attr['cut_hash'])) {
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
|
||||
}
|
||||
|
||||
$this->endValue($cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps an ellipsis for cut children.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
*/
|
||||
protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
|
||||
{
|
||||
@@ -318,8 +343,6 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
/**
|
||||
* Dumps a key in a hash structure.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
*/
|
||||
protected function dumpKey(Cursor $cursor)
|
||||
{
|
||||
@@ -327,7 +350,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 +387,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 '*':
|
||||
@@ -386,16 +409,16 @@ class CliDumper extends AbstractDumper
|
||||
}
|
||||
}
|
||||
|
||||
$this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
|
||||
$this->line .= $bin.$this->style($style, $key[1], $attr).($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,15 +432,20 @@ 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();
|
||||
}
|
||||
|
||||
if (null === $this->handlesHrefGracefully) {
|
||||
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
|
||||
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
|
||||
}
|
||||
|
||||
if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
|
||||
$prefix = substr($value, 0, -$attr['ellipsis']);
|
||||
if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
|
||||
if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && str_starts_with($prefix, $_SERVER[$pwd])) {
|
||||
$prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd]));
|
||||
}
|
||||
if (!empty($attr['ellipsis-tail'])) {
|
||||
@@ -427,19 +455,19 @@ class CliDumper extends AbstractDumper
|
||||
$value = substr($value, -$attr['ellipsis']);
|
||||
}
|
||||
|
||||
return $this->style('default', $prefix).$this->style($style, $value);
|
||||
}
|
||||
$value = $this->style('default', $prefix).$this->style($style, $value);
|
||||
|
||||
$style = $this->styles[$style];
|
||||
goto href;
|
||||
}
|
||||
|
||||
$map = static::$controlCharsMap;
|
||||
$startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : '';
|
||||
$endCchr = $this->colors ? "\033[m\033[{$style}m" : '';
|
||||
$endCchr = $this->colors ? "\033[m\033[{$this->styles[$style]}m" : '';
|
||||
$value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) {
|
||||
$s = $startCchr;
|
||||
$c = $c[$i = 0];
|
||||
do {
|
||||
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
|
||||
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
|
||||
} while (isset($c[++$i]));
|
||||
|
||||
return $s.$endCchr;
|
||||
@@ -449,15 +477,31 @@ class CliDumper extends AbstractDumper
|
||||
if ($cchrCount && "\033" === $value[0]) {
|
||||
$value = substr($value, \strlen($startCchr));
|
||||
} else {
|
||||
$value = "\033[{$style}m".$value;
|
||||
$value = "\033[{$this->styles[$style]}m".$value;
|
||||
}
|
||||
if ($cchrCount && $endCchr === substr($value, -\strlen($endCchr))) {
|
||||
if ($cchrCount && str_ends_with($value, $endCchr)) {
|
||||
$value = substr($value, 0, -\strlen($endCchr));
|
||||
} else {
|
||||
$value .= "\033[{$this->styles['default']}m";
|
||||
}
|
||||
}
|
||||
|
||||
href:
|
||||
if ($this->colors && $this->handlesHrefGracefully) {
|
||||
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
|
||||
if ('note' === $style) {
|
||||
$value .= "\033]8;;{$href}\033\\^\033]8;;\033\\";
|
||||
} else {
|
||||
$attr['href'] = $href;
|
||||
}
|
||||
}
|
||||
if (isset($attr['href'])) {
|
||||
$value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\";
|
||||
}
|
||||
} elseif ($attr['if_links'] ?? false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -495,8 +539,8 @@ class CliDumper extends AbstractDumper
|
||||
}
|
||||
}
|
||||
|
||||
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
|
||||
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
|
||||
$h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null];
|
||||
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'w') : $this->outputStream;
|
||||
|
||||
return static::$defaultColors = $this->hasColorSupport($h);
|
||||
}
|
||||
@@ -514,6 +558,10 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
protected function endValue(Cursor $cursor)
|
||||
{
|
||||
if (-1 === $cursor->hashType) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Stub::ARRAY_INDEXED === $cursor->hashType || Stub::ARRAY_ASSOC === $cursor->hashType) {
|
||||
if (self::DUMP_TRAILING_COMMA & $this->flags && 0 < $cursor->depth) {
|
||||
$this->line .= ',';
|
||||
@@ -532,15 +580,18 @@ class CliDumper extends AbstractDumper
|
||||
* https://github.com/composer/xdebug-handler
|
||||
*
|
||||
* @param mixed $stream A CLI output stream
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hasColorSupport($stream)
|
||||
private function hasColorSupport($stream): bool
|
||||
{
|
||||
if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Follow https://no-color.org/
|
||||
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('Hyper' === getenv('TERM_PROGRAM')) {
|
||||
return true;
|
||||
}
|
||||
@@ -572,10 +623,8 @@ class CliDumper extends AbstractDumper
|
||||
* Note that this does not check an output stream, but relies on environment
|
||||
* variables from known implementations, or a PHP and Windows version that
|
||||
* supports true color.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isWindowsTrueColor()
|
||||
private function isWindowsTrueColor(): bool
|
||||
{
|
||||
$result = 183 <= getenv('ANSICON_VER')
|
||||
|| 'ON' === getenv('ConEmuANSI')
|
||||
@@ -594,4 +643,13 @@ class CliDumper extends AbstractDumper
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function getSourceLink(string $file, int $line)
|
||||
{
|
||||
if ($fmt = $this->displayOptions['fileLinkFormat']) {
|
||||
return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file.'#L'.$line);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -24,9 +24,9 @@ final class CliContextProvider implements ContextProviderInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
return array(
|
||||
'command_line' => $commandLine = implode(' ', $_SERVER['argv']),
|
||||
return [
|
||||
'command_line' => $commandLine = implode(' ', $_SERVER['argv'] ?? []),
|
||||
'identifier' => hash('crc32b', $commandLine.$_SERVER['REQUEST_TIME_FLOAT']),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,7 @@ final class RequestContextProvider implements ContextProviderInterface
|
||||
$this->requestStack = $requestStack;
|
||||
$this->cloner = new VarCloner();
|
||||
$this->cloner->setMaxItems(0);
|
||||
$this->cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
|
||||
}
|
||||
|
||||
public function getContext(): ?array
|
||||
@@ -39,11 +41,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),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ final class SourceContextProvider implements ContextProviderInterface
|
||||
|
||||
public function getContext(): ?array
|
||||
{
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit);
|
||||
$trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit);
|
||||
|
||||
$file = $trace[1]['file'];
|
||||
$line = $trace[1]['line'];
|
||||
@@ -52,11 +52,11 @@ final class SourceContextProvider implements ContextProviderInterface
|
||||
&& 'dump' === $trace[$i]['function']
|
||||
&& VarDumper::class === $trace[$i]['class']
|
||||
) {
|
||||
$file = $trace[$i]['file'];
|
||||
$line = $trace[$i]['line'];
|
||||
$file = $trace[$i]['file'] ?? $file;
|
||||
$line = $trace[$i]['line'] ?? $line;
|
||||
|
||||
while (++$i < $this->limit) {
|
||||
if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) {
|
||||
if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && !str_starts_with($trace[$i]['function'], 'call_user_func')) {
|
||||
$file = $trace[$i]['file'];
|
||||
$line = $trace[$i]['line'];
|
||||
|
||||
@@ -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,12 +93,12 @@ 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) {
|
||||
$context['project_dir'] = $this->projectDir;
|
||||
if (0 === strpos($file, $this->projectDir)) {
|
||||
if (str_starts_with($file, $this->projectDir)) {
|
||||
$context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
43
vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php
vendored
Normal file
43
vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
|
||||
|
||||
/**
|
||||
* @author Kévin Thérage <therage.kevin@gmail.com>
|
||||
*/
|
||||
class ContextualizedDumper implements DataDumperInterface
|
||||
{
|
||||
private $wrappedDumper;
|
||||
private $contextProviders;
|
||||
|
||||
/**
|
||||
* @param ContextProviderInterface[] $contextProviders
|
||||
*/
|
||||
public function __construct(DataDumperInterface $wrappedDumper, array $contextProviders)
|
||||
{
|
||||
$this->wrappedDumper = $wrappedDumper;
|
||||
$this->contextProviders = $contextProviders;
|
||||
}
|
||||
|
||||
public function dump(Data $data)
|
||||
{
|
||||
$context = [];
|
||||
foreach ($this->contextProviders as $contextProvider) {
|
||||
$context[\get_class($contextProvider)] = $contextProvider->getContext();
|
||||
}
|
||||
|
||||
$this->wrappedDumper->dump($data->withContext($context));
|
||||
}
|
||||
}
|
160
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
160
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
@@ -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}
|
||||
@@ -81,7 +81,7 @@ class HtmlDumper extends CliDumper
|
||||
{
|
||||
AbstractDumper::__construct($output, $charset, $flags);
|
||||
$this->dumpId = 'sf-dump-'.mt_rand();
|
||||
$this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->styles = static::$themes['dark'] ?? self::$themes['dark'];
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -153,13 +153,13 @@ class HtmlDumper extends CliDumper
|
||||
*/
|
||||
protected function getDumpHeader()
|
||||
{
|
||||
$this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
|
||||
$this->headerIsDumped = $this->outputStream ?? $this->lineDumper;
|
||||
|
||||
if (null !== $this->dumpHeader) {
|
||||
return $this->dumpHeader;
|
||||
}
|
||||
|
||||
$line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML'
|
||||
$line = str_replace('{$options}', json_encode($this->displayOptions, \JSON_FORCE_OBJECT), <<<'EOHTML'
|
||||
<script>
|
||||
Sfdump = window.Sfdump || (function (doc) {
|
||||
|
||||
@@ -314,13 +314,21 @@ return function (root, x) {
|
||||
}
|
||||
|
||||
function a(e, f) {
|
||||
addEventListener(root, e, function (e) {
|
||||
addEventListener(root, e, function (e, n) {
|
||||
if ('A' == e.target.tagName) {
|
||||
f(e.target, e);
|
||||
} else if ('A' == e.target.parentNode.tagName) {
|
||||
f(e.target.parentNode, e);
|
||||
} else if (e.target.nextElementSibling && 'A' == e.target.nextElementSibling.tagName) {
|
||||
f(e.target.nextElementSibling, e, true);
|
||||
} else {
|
||||
n = /\bsf-dump-ellipsis\b/.test(e.target.className) ? e.target.parentNode : e.target;
|
||||
|
||||
if ((n = n.nextElementSibling) && 'A' == n.tagName) {
|
||||
if (!/\bsf-dump-toggle\b/.test(n.className)) {
|
||||
n = n.nextElementSibling || n;
|
||||
}
|
||||
|
||||
f(n, e, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -363,7 +371,7 @@ return function (root, x) {
|
||||
if (/\bsf-dump-toggle\b/.test(a.className)) {
|
||||
e.preventDefault();
|
||||
if (!toggle(a, isCtrlKey(e))) {
|
||||
var r = doc.getElementById(a.getAttribute('href').substr(1)),
|
||||
var r = doc.getElementById(a.getAttribute('href').slice(1)),
|
||||
s = r.previousSibling,
|
||||
f = r.parentNode,
|
||||
t = a.parentNode;
|
||||
@@ -430,7 +438,7 @@ return function (root, x) {
|
||||
toggle(a);
|
||||
}
|
||||
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
|
||||
a = a.substr(1);
|
||||
a = a.slice(1);
|
||||
elt.className += ' '+a;
|
||||
|
||||
if (/[\[{]$/.test(elt.previousSibling.nodeValue)) {
|
||||
@@ -469,7 +477,7 @@ return function (root, x) {
|
||||
return this.current();
|
||||
}
|
||||
this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0;
|
||||
|
||||
|
||||
return this.current();
|
||||
},
|
||||
previous: function () {
|
||||
@@ -477,7 +485,7 @@ return function (root, x) {
|
||||
return this.current();
|
||||
}
|
||||
this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1);
|
||||
|
||||
|
||||
return this.current();
|
||||
},
|
||||
isEmpty: function () {
|
||||
@@ -500,12 +508,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 +530,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);
|
||||
@@ -560,11 +569,11 @@ return function (root, x) {
|
||||
"sf-dump-protected",
|
||||
"sf-dump-private",
|
||||
].map(xpathHasClass).join(' or ');
|
||||
|
||||
|
||||
var xpathResult = doc.evaluate('.//span[' + classMatches + '][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
|
||||
|
||||
while (node = xpathResult.iterateNext()) state.nodes.push(node);
|
||||
|
||||
|
||||
showCurrent(state);
|
||||
}, 400);
|
||||
});
|
||||
@@ -583,6 +592,15 @@ return function (root, x) {
|
||||
var isSearchActive = !/\bsf-dump-search-hidden\b/.test(search.className);
|
||||
if ((114 === e.keyCode && !isSearchActive) || (isCtrlKey(e) && 70 === e.keyCode)) {
|
||||
/* F3 or CMD/CTRL + F */
|
||||
if (70 === e.keyCode && document.activeElement === searchInput) {
|
||||
/*
|
||||
* If CMD/CTRL + F is hit while having focus on search input,
|
||||
* the user probably meant to trigger browser search instead.
|
||||
* Let the browser execute its behavior:
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
search.className = search.className.replace(/\bsf-dump-search-hidden\b/, '');
|
||||
searchInput.focus();
|
||||
@@ -641,6 +659,7 @@ pre.sf-dump {
|
||||
display: block;
|
||||
white-space: pre;
|
||||
padding: 5px;
|
||||
overflow: initial !important;
|
||||
}
|
||||
pre.sf-dump:after {
|
||||
content: "";
|
||||
@@ -655,11 +674,6 @@ pre.sf-dump span {
|
||||
pre.sf-dump .sf-dump-compact {
|
||||
display: none;
|
||||
}
|
||||
pre.sf-dump abbr {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
cursor: help;
|
||||
}
|
||||
pre.sf-dump a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
@@ -667,6 +681,13 @@ pre.sf-dump a {
|
||||
outline: none;
|
||||
color: inherit;
|
||||
}
|
||||
pre.sf-dump img {
|
||||
max-width: 50em;
|
||||
max-height: 50em;
|
||||
margin: .5em 0 0 0;
|
||||
padding: 0;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
|
||||
}
|
||||
pre.sf-dump .sf-dump-ellipsis {
|
||||
display: inline-block;
|
||||
overflow: visible;
|
||||
@@ -709,14 +730,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 +756,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 {
|
||||
@@ -770,15 +794,36 @@ EOHTML
|
||||
foreach ($this->styles as $class => $style) {
|
||||
$line .= 'pre.sf-dump'.('default' === $class ? ', pre.sf-dump' : '').' .sf-dump-'.$class.'{'.$style.'}';
|
||||
}
|
||||
$line .= 'pre.sf-dump .sf-dump-ellipsis-note{'.$this->styles['note'].'}';
|
||||
|
||||
return $this->dumpHeader = preg_replace('/\s+/', ' ', $line).'</style>'.$this->dumpHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut)
|
||||
{
|
||||
if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) {
|
||||
$this->dumpKey($cursor);
|
||||
$this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []).' <samp>';
|
||||
$this->endValue($cursor);
|
||||
$this->line .= $this->indentPad;
|
||||
$this->line .= sprintf('<img src="data:%s;base64,%s" /></samp>', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data']));
|
||||
$this->endValue($cursor);
|
||||
} else {
|
||||
parent::dumpString($cursor, $str, $bin, $cut);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
{
|
||||
if (Cursor::HASH_OBJECT === $type) {
|
||||
$cursor->attr['depth'] = $cursor->depth;
|
||||
}
|
||||
parent::enterHash($cursor, $type, $class, false);
|
||||
|
||||
if ($cursor->skipChildren) {
|
||||
@@ -819,7 +864,7 @@ EOHTML
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function style($style, $value, $attr = array())
|
||||
protected function style($style, $value, $attr = [])
|
||||
{
|
||||
if ('' === $value) {
|
||||
return '';
|
||||
@@ -837,13 +882,18 @@ EOHTML
|
||||
}
|
||||
|
||||
if ('const' === $style && isset($attr['value'])) {
|
||||
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
|
||||
$style .= sprintf(' title="%s"', esc(\is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
|
||||
} elseif ('public' === $style) {
|
||||
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
|
||||
} elseif ('str' === $style && 1 < $attr['length']) {
|
||||
$style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
|
||||
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
|
||||
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, substr($v, $c + 1));
|
||||
} elseif ('note' === $style && 0 < ($attr['depth'] ?? 0) && false !== $c = strrpos($value, '\\')) {
|
||||
$style .= ' title=""';
|
||||
$attr += [
|
||||
'ellipsis' => \strlen($value) - $c,
|
||||
'ellipsis-type' => 'note',
|
||||
'ellipsis-tail' => 1,
|
||||
];
|
||||
} elseif ('protected' === $style) {
|
||||
$style .= ' title="Protected property"';
|
||||
} elseif ('meta' === $style && isset($attr['title'])) {
|
||||
@@ -864,7 +914,7 @@ EOHTML
|
||||
|
||||
if (!empty($attr['ellipsis-tail'])) {
|
||||
$tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
|
||||
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
|
||||
$v .= sprintf('<span class=%s>%s</span>%s', $class, substr($label, 0, $tail), substr($label, $tail));
|
||||
} else {
|
||||
$v .= $label;
|
||||
}
|
||||
@@ -886,13 +936,13 @@ EOHTML
|
||||
$s .= '">';
|
||||
}
|
||||
|
||||
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
|
||||
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
|
||||
} while (isset($c[++$i]));
|
||||
|
||||
return $s.'</span>';
|
||||
}, $v).'</span>';
|
||||
|
||||
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
|
||||
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
|
||||
$attr['href'] = $href;
|
||||
}
|
||||
if (isset($attr['href'])) {
|
||||
@@ -914,21 +964,21 @@ EOHTML
|
||||
if (-1 === $this->lastDepth) {
|
||||
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
|
||||
}
|
||||
if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
|
||||
if ($this->headerIsDumped !== ($this->outputStream ?? $this->lineDumper)) {
|
||||
$this->line = $this->getDumpHeader().$this->line;
|
||||
}
|
||||
|
||||
if (-1 === $depth) {
|
||||
$args = array('"'.$this->dumpId.'"');
|
||||
$args = ['"'.$this->dumpId.'"'];
|
||||
if ($this->extraDisplayOptions) {
|
||||
$args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
|
||||
$args[] = json_encode($this->extraDisplayOptions, \JSON_FORCE_OBJECT);
|
||||
}
|
||||
// Replace is for BC
|
||||
$this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
|
||||
}
|
||||
$this->lastDepth = $depth;
|
||||
|
||||
$this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');
|
||||
$this->line = mb_encode_numericentity($this->line, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
|
||||
|
||||
if (-1 === $depth) {
|
||||
AbstractDumper::dumpLine(0);
|
||||
@@ -936,19 +986,19 @@ EOHTML
|
||||
AbstractDumper::dumpLine($depth);
|
||||
}
|
||||
|
||||
private function getSourceLink($file, $line)
|
||||
private function getSourceLink(string $file, int $line)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
function esc($str)
|
||||
function esc(string $str)
|
||||
{
|
||||
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
||||
return htmlspecialchars($str, \ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user