upgraded dependencies

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

View File

@@ -81,11 +81,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the default character encoding to use for non-UTF8 strings.
*
* @param string $charset The default character encoding to use for non-UTF8 strings
*
* @return string The previous charset
*/
public function setCharset($charset)
public function setCharset(string $charset)
{
$prev = $this->charset;
@@ -104,7 +102,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @return string The previous indent pad
*/
public function setIndentPad($pad)
public function setIndentPad(string $pad)
{
$prev = $this->indentPad;
$this->indentPad = $pad;
@@ -161,7 +159,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
* or -1 to signal the end-of-dump to the line dumper callable
*/
protected function dumpLine($depth)
protected function dumpLine(int $depth)
{
($this->lineDumper)($this->line, $depth, $this->indentPad);
$this->line = '';
@@ -169,12 +167,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Generic line dumper callback.
*
* @param string $line The line to write
* @param int $depth The recursive depth in the dumped structure
* @param string $indentPad The line indent pad
*/
protected function echoLine($line, $depth, $indentPad)
protected function echoLine(string $line, int $depth, string $indentPad)
{
if (-1 !== $depth) {
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
@@ -184,11 +178,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Converts a non-UTF-8 string to UTF-8.
*
* @param string|null $s The non-UTF-8 string to convert
*
* @return string|null The string converted to UTF-8
* @return string|null
*/
protected function utf8Encode($s)
protected function utf8Encode(?string $s)
{
if (null === $s || preg_match('//u', $s)) {
return $s;

View File

@@ -88,22 +88,18 @@ class CliDumper extends AbstractDumper
/**
* Enables/disables colored output.
*
* @param bool $colors
*/
public function setColors($colors)
public function setColors(bool $colors)
{
$this->colors = (bool) $colors;
$this->colors = $colors;
}
/**
* Sets the maximum number of characters per line for dumped strings.
*
* @param int $maxStringWidth
*/
public function setMaxStringWidth($maxStringWidth)
public function setMaxStringWidth(int $maxStringWidth)
{
$this->maxStringWidth = (int) $maxStringWidth;
$this->maxStringWidth = $maxStringWidth;
}
/**
@@ -129,7 +125,7 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
public function dumpScalar(Cursor $cursor, $type, $value)
public function dumpScalar(Cursor $cursor, string $type, $value)
{
$this->dumpKey($cursor);
@@ -143,11 +139,20 @@ class CliDumper extends AbstractDumper
case 'integer':
$style = 'num';
if (isset($this->styles['integer'])) {
$style = 'integer';
}
break;
case 'double':
$style = 'num';
if (isset($this->styles['float'])) {
$style = 'float';
}
switch (true) {
case \INF === $value: $value = 'INF'; break;
case -\INF === $value: $value = '-INF'; break;
@@ -183,7 +188,7 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
public function dumpString(Cursor $cursor, $str, $bin, $cut)
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
{
$this->dumpKey($cursor);
$attr = $cursor->attr;
@@ -199,7 +204,7 @@ class CliDumper extends AbstractDumper
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
];
$str = explode("\n", $str);
$str = $bin && false !== strpos($str, "\0") ? [$str] : explode("\n", $str);
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
unset($str[1]);
$str[0] .= "\n";
@@ -271,7 +276,7 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild)
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
@@ -312,7 +317,7 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut)
{
if (empty($cursor->attr['cut_hash'])) {
$this->dumpEllipsis($cursor, $hasChild, $cut);
@@ -328,7 +333,7 @@ class CliDumper extends AbstractDumper
* @param bool $hasChild When the dump of the hash has child item
* @param int $cut The number of items the hash has been cut by
*/
protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut)
{
if ($cut) {
$this->line .= ' …';
@@ -430,9 +435,9 @@ class CliDumper extends AbstractDumper
* @param string $value The value being styled
* @param array $attr Optional context information
*
* @return string The value with style decoration
* @return string
*/
protected function style($style, $value, $attr = [])
protected function style(string $style, string $value, array $attr = [])
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
@@ -506,7 +511,7 @@ class CliDumper extends AbstractDumper
}
/**
* @return bool Tells if the current output stream supports ANSI colors or not
* @return bool
*/
protected function supportsColors()
{
@@ -527,12 +532,14 @@ class CliDumper extends AbstractDumper
case '--color=yes':
case '--color=force':
case '--color=always':
case '--colors=always':
return static::$defaultColors = true;
case '--no-ansi':
case '--color=no':
case '--color=none':
case '--color=never':
case '--colors=never':
return static::$defaultColors = false;
}
}
@@ -548,7 +555,7 @@ class CliDumper extends AbstractDumper
/**
* {@inheritdoc}
*/
protected function dumpLine($depth, $endOfValue = false)
protected function dumpLine(int $depth, bool $endOfValue = false)
{
if ($this->colors) {
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
@@ -604,17 +611,7 @@ class CliDumper extends AbstractDumper
|| 'xterm' === getenv('TERM');
}
if (\function_exists('stream_isatty')) {
return @stream_isatty($stream);
}
if (\function_exists('posix_isatty')) {
return @posix_isatty($stream);
}
$stat = @fstat($stream);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
return stream_isatty($stream);
}
/**
@@ -631,7 +628,7 @@ class CliDumper extends AbstractDumper
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
if (!$result && \PHP_VERSION_ID >= 70200) {
if (!$result) {
$version = sprintf(
'%s.%s.%s',
PHP_WINDOWS_VERSION_MAJOR,

View File

@@ -18,8 +18,5 @@ namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
*/
interface ContextProviderInterface
{
/**
* @return array|null Context data or null if unable to provide any context
*/
public function getContext(): ?array;
}

View File

@@ -116,21 +116,16 @@ class HtmlDumper extends CliDumper
/**
* Sets an HTML header that will be dumped once in the output stream.
*
* @param string $header An HTML string
*/
public function setDumpHeader($header)
public function setDumpHeader(?string $header)
{
$this->dumpHeader = $header;
}
/**
* Sets an HTML prefix and suffix that will encapse every single dump.
*
* @param string $prefix The prepended HTML string
* @param string $suffix The appended HTML string
*/
public function setDumpBoundaries($prefix, $suffix)
public function setDumpBoundaries(string $prefix, string $suffix)
{
$this->dumpPrefix = $prefix;
$this->dumpSuffix = $suffix;
@@ -171,6 +166,9 @@ var refStyle = doc.createElement('style'),
e.addEventListener(n, cb, false);
};
refStyle.innerHTML = 'pre.sf-dump .sf-dump-compact, .sf-dump-str-collapse .sf-dump-str-collapse, .sf-dump-str-expand .sf-dump-str-expand { display: none; }';
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
refStyle = doc.createElement('style');
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
if (!doc.addEventListener) {
@@ -424,19 +422,13 @@ return function (root, x) {
a.innerHTML += ' ';
}
a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children';
a.innerHTML += '<span>▼</span>';
a.innerHTML += elt.className == 'sf-dump-compact' ? '<span>▶</span>' : '<span>▼</span>';
a.className += ' sf-dump-toggle';
x = 1;
if ('sf-dump' != elt.parentNode.className) {
x += elt.parentNode.getAttribute('data-depth')/1;
}
elt.setAttribute('data-depth', x);
var className = elt.className;
elt.className = 'sf-dump-expanded';
if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) {
toggle(a);
}
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
a = a.slice(1);
elt.className += ' '+a;
@@ -671,9 +663,6 @@ pre.sf-dump:after {
pre.sf-dump span {
display: inline;
}
pre.sf-dump .sf-dump-compact {
display: none;
}
pre.sf-dump a {
text-decoration: none;
cursor: pointer;
@@ -705,12 +694,6 @@ pre.sf-dump code {
padding:0;
background:none;
}
.sf-dump-str-collapse .sf-dump-str-collapse {
display: none;
}
.sf-dump-str-expand .sf-dump-str-expand {
display: none;
}
.sf-dump-public.sf-dump-highlight,
.sf-dump-protected.sf-dump-highlight,
.sf-dump-private.sf-dump-highlight,
@@ -802,11 +785,12 @@ EOHTML
/**
* {@inheritdoc}
*/
public function dumpString(Cursor $cursor, $str, $bin, $cut)
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
{
if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) {
$this->dumpKey($cursor);
$this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []).' <samp>';
$this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []);
$this->line .= $cursor->depth >= $this->displayOptions['maxDepth'] ? ' <samp class=sf-dump-compact>' : ' <samp class=sf-dump-expanded>';
$this->endValue($cursor);
$this->line .= $this->indentPad;
$this->line .= sprintf('<img src="data:%s;base64,%s" /></samp>', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data']));
@@ -819,25 +803,23 @@ EOHTML
/**
* {@inheritdoc}
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild)
{
if (Cursor::HASH_OBJECT === $type) {
$cursor->attr['depth'] = $cursor->depth;
}
parent::enterHash($cursor, $type, $class, false);
if ($cursor->skipChildren) {
if ($cursor->skipChildren || $cursor->depth >= $this->displayOptions['maxDepth']) {
$cursor->skipChildren = false;
$eol = ' class=sf-dump-compact>';
} elseif ($this->expandNextHash) {
} else {
$this->expandNextHash = false;
$eol = ' class=sf-dump-expanded>';
} else {
$eol = '>';
}
if ($hasChild) {
$this->line .= '<samp';
$this->line .= '<samp data-depth='.($cursor->depth + 1);
if ($cursor->refIndex) {
$r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2;
$r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex;
@@ -852,7 +834,7 @@ EOHTML
/**
* {@inheritdoc}
*/
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
if ($hasChild) {
@@ -864,7 +846,7 @@ EOHTML
/**
* {@inheritdoc}
*/
protected function style($style, $value, $attr = [])
protected function style(string $style, string $value, array $attr = [])
{
if ('' === $value) {
return '';
@@ -959,7 +941,7 @@ EOHTML
/**
* {@inheritdoc}
*/
protected function dumpLine($depth, $endOfValue = false)
protected function dumpLine(int $depth, bool $endOfValue = false)
{
if (-1 === $this->lastDepth) {
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;