Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/var-dumper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.3.3
Choose a base ref
...
head repository: symfony/var-dumper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.3.4
Choose a head ref
  • 17 commits
  • 20 files changed
  • 4 contributors

Commits on Jul 2, 2021

  1. Backport type fixes

    nicolas-grekas committed Jul 2, 2021
    Copy the full SHA
    6153ced View commit details
  2. Merge branch '4.4' into 5.2

    * 4.4:
      Backport type fixes
      uzb translation
      [DependencyInjection] Fix doc blocks
      [DependencyInjection] Turn $defaultDeprecationTemplate into a constant
      [Form] better form doc types to support static analysis
    nicolas-grekas committed Jul 2, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    targos Michaël Zasso
    Copy the full SHA
    d01f1bb View commit details
  3. Backport type fixes

    nicolas-grekas committed Jul 2, 2021
    2

    Verified

    This commit was signed with the committer’s verified signature.
    targos Michaël Zasso
    Copy the full SHA
    e24d8fc View commit details
  4. Merge branch '5.2' into 5.3

    * 5.2:
      Backport type fixes
      Fix CS
      Avoid triggering the autoloader in Deprecation::isLegacy()
      fix markdown markup
      Backport type fixes
      uzb translation
      [DependencyInjection] Fix doc blocks
      [DependencyInjection] Turn $defaultDeprecationTemplate into a constant
      [Form] better form doc types to support static analysis
    nicolas-grekas committed Jul 2, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    targos Michaël Zasso
    Copy the full SHA
    93225d2 View commit details

Commits on Jul 14, 2021

  1. [VarDumper] Support for intersection types

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Jul 14, 2021
    Copy the full SHA
    bbfcb4d View commit details

Commits on Jul 15, 2021

  1. Merge branch '4.4' into 5.2

    * 4.4:
      [HttpFoundation] Fix return types of SessionHandler::gc()
      [Cache] Support decorated Dbal drivers in PdoAdapter
      [VarDumper] Support for intersection types
    nicolas-grekas committed Jul 15, 2021
    Copy the full SHA
    7ec82fa View commit details
  2. Merge branch '5.2' into 5.3

    * 5.2:
      [ErrorHandler] fix parsing `@return array<foo>` annotations
      [HttpFoundation] Fix return types of SessionHandler::gc()
      [Cache] Support decorated Dbal drivers in PdoAdapter
      [VarDumper] Support for intersection types
    nicolas-grekas committed Jul 15, 2021
    Copy the full SHA
    1800f18 View commit details

Commits on Jul 18, 2021

  1. Copy the full SHA
    5a443a9 View commit details
  2. Merge branch '4.4' into 5.2

    * 4.4:
      Simplify some code with null coalesce operator
    derrabus committed Jul 18, 2021
    Copy the full SHA
    56d2cd7 View commit details
  3. Merge branch '5.2' into 5.3

    * 5.2:
      Simplify some code with null coalesce operator
      Don't use deprecated TestLogger class
    derrabus committed Jul 18, 2021
    Copy the full SHA
    f1a9f56 View commit details

Commits on Jul 21, 2021

  1. Leverage str_ends_with

    added the php80 polyfill to requirements when necessary
    Tobion committed Jul 21, 2021
    Copy the full SHA
    63dd9f8 View commit details
  2. Leverage str_contains/str_starts_with

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus authored and nicolas-grekas committed Jul 21, 2021
    Copy the full SHA
    bf72df1 View commit details
  3. Merge branch '4.4' into 5.2

    * 4.4:
      Leverage str_contains/str_starts_with
      Leverage str_ends_with
    nicolas-grekas committed Jul 21, 2021
    Copy the full SHA
    bb07805 View commit details
  4. Merge branch '5.2' into 5.3

    * 5.2:
      Leverage str_contains/str_starts_with
      Leverage str_ends_with
    nicolas-grekas committed Jul 21, 2021
    Copy the full SHA
    8d1d0a0 View commit details

Commits on Jul 23, 2021

  1. Copy the full SHA
    391d6d0 View commit details
  2. Merge branch '4.4' into 5.2

    * 4.4:
      [4.4] Add missing `@return` annotations
      Handle lock with long key
    nicolas-grekas committed Jul 23, 2021
    Copy the full SHA
    d5f42c3 View commit details
  3. Merge branch '5.2' into 5.3

    * 5.2:
      [5.2] Add missing `@return` annotations
      [4.4] Add missing `@return` annotations
      Handle lock with long key
      #42227 update phpdoc to recommend createIndex over ensureIndex
    nicolas-grekas committed Jul 23, 2021
    Copy the full SHA
    a895407 View commit details
4 changes: 2 additions & 2 deletions Caster/ClassStub.php
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ public function __construct(string $identifier, $callable = null)
}
}

if (false !== strpos($identifier, "@anonymous\0")) {
if (str_contains($identifier, "@anonymous\0")) {
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
}, $identifier);
@@ -65,7 +65,7 @@ public function __construct(string $identifier, $callable = null)
$s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true, Caster::EXCLUDE_VERBOSE);
$s = ReflectionCaster::getSignature($s);

if ('()' === substr($identifier, -2)) {
if (str_ends_with($identifier, '()')) {
$this->value = substr_replace($identifier, $s, -2);
} else {
$this->value .= $s;
2 changes: 1 addition & 1 deletion Caster/DOMCaster.php
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ public static function castLength($dom, array $a, Stub $stub, bool $isNested)
return $a;
}

public static function castImplementation($dom, array $a, Stub $stub, bool $isNested)
public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
4 changes: 2 additions & 2 deletions Caster/ExceptionCaster.php
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo
$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")) {
if (str_starts_with($label, "\0~collapse=0")) {
if ($collapse) {
$label = substr_replace($label, '1', 11, 1);
} else {
@@ -281,7 +281,7 @@ private static function filterExceptionArray(string $xClass, array $a, string $x
}
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);

if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
}, $a[Caster::PREFIX_PROTECTED.'message']);
10 changes: 5 additions & 5 deletions Caster/LinkStub.php
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ class LinkStub extends ConstStub
private static $vendorRoots;
private static $composerRoots;

public function __construct($label, int $line = 0, $href = null)
public function __construct(string $label, int $line = 0, string $href = null)
{
$this->value = $label;

@@ -33,12 +33,12 @@ public function __construct($label, int $line = 0, $href = null)
if (!\is_string($href)) {
return;
}
if (0 === strpos($href, 'file://')) {
if (str_starts_with($href, 'file://')) {
if ($href === $label) {
$label = substr($label, 7);
}
$href = substr($href, 7);
} elseif (false !== strpos($href, '://')) {
} elseif (str_contains($href, '://')) {
$this->attr['href'] = $href;

return;
@@ -69,7 +69,7 @@ private function getComposerRoot(string $file, bool &$inVendor)
self::$vendorRoots = [];

foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname($r->getFileName(), 2);
if (is_file($v.'/composer/installed.json')) {
@@ -85,7 +85,7 @@ private function getComposerRoot(string $file, bool &$inVendor)
}

foreach (self::$vendorRoots as $root) {
if ($inVendor = 0 === strpos($file, $root)) {
if ($inVendor = str_starts_with($file, $root)) {
return $root;
}
}
2 changes: 1 addition & 1 deletion Caster/MemcachedCaster.php
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ private static function getOptionConstants(): array

$optionConstants = [];
foreach ($reflectedMemcached->getConstants() as $constantKey => $value) {
if (0 === strpos($constantKey, 'OPT_')) {
if (str_starts_with($constantKey, 'OPT_')) {
$optionConstants[$constantKey] = $value;
}
}
20 changes: 10 additions & 10 deletions Caster/RdKafkaCaster.php
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
*/
class RdKafkaCaster
{
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, $isNested)
public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -51,7 +51,7 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub,
return $a;
}

public static function castTopic(Topic $c, array $a, Stub $stub, $isNested)
public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -75,7 +75,7 @@ public static function castTopicPartition(TopicPartition $c, array $a)
return $a;
}

public static function castMessage(Message $c, array $a, Stub $stub, $isNested)
public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -86,7 +86,7 @@ public static function castMessage(Message $c, array $a, Stub $stub, $isNested)
return $a;
}

public static function castConf(Conf $c, array $a, Stub $stub, $isNested)
public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -97,7 +97,7 @@ public static function castConf(Conf $c, array $a, Stub $stub, $isNested)
return $a;
}

public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNested)
public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -108,7 +108,7 @@ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNest
return $a;
}

public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested)
public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -121,14 +121,14 @@ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested)
return $a;
}

public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, $isNested)
public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested)
{
$a += iterator_to_array($c);

return $a;
}

public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, $isNested)
public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -140,7 +140,7 @@ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub,
return $a;
}

public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, $isNested)
public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

@@ -153,7 +153,7 @@ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stu
return $a;
}

public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, $isNested)
public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

6 changes: 3 additions & 3 deletions Caster/ReflectionCaster.php
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNe

$a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);

if (false === strpos($c->name, '{closure}')) {
if (!str_contains($c->name, '{closure}')) {
$stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name;
unset($a[$prefix.'class']);
}
@@ -102,7 +102,7 @@ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
];
} elseif ($c instanceof \ReflectionUnionType) {
} elseif ($c instanceof \ReflectionUnionType || $c instanceof \ReflectionIntersectionType) {
$a[$prefix.'allowsNull'] = $c->allowsNull();
self::addMap($a, $c, [
'types' => 'getTypes',
@@ -381,7 +381,7 @@ public static function getSignature(array $a)
} elseif (\is_array($v)) {
$signature .= $v ? '[…'.\count($v).']' : '[]';
} elseif (\is_string($v)) {
$signature .= 10 > \strlen($v) && false === strpos($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'";
$signature .= 10 > \strlen($v) && !str_contains($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'";
} elseif (\is_bool($v)) {
$signature .= $v ? 'true' : 'false';
} else {
4 changes: 2 additions & 2 deletions Caster/ResourceCaster.php
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public static function castProcess($process, array $a, Stub $stub, bool $isNeste
public static function castStream($stream, array $a, Stub $stub, bool $isNested)
{
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
if (isset($a['uri'])) {
if ($a['uri'] ?? false) {
$a['uri'] = new LinkStub($a['uri']);
}

@@ -60,7 +60,7 @@ public static function castStreamContext($stream, array $a, Stub $stub, bool $is
return @stream_context_get_params($stream) ?: $a;
}

public static function castGd($gd, array $a, Stub $stub, $isNested)
public static function castGd($gd, array $a, Stub $stub, bool $isNested)
{
$a['size'] = imagesx($gd).'x'.imagesy($gd);
$a['trueColor'] = imageistruecolor($gd);
4 changes: 2 additions & 2 deletions Caster/SplCaster.php
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub
return self::castSplArray($c, $a, $stub, $isNested);
}

public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
@@ -129,7 +129,7 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool
}
}

if (isset($a[$prefix.'realPath'])) {
if ($a[$prefix.'realPath'] ?? false) {
$a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
}

2 changes: 1 addition & 1 deletion Cloner/AbstractCloner.php
Original file line number Diff line number Diff line change
@@ -309,7 +309,7 @@ protected function castObject(Stub $stub, bool $isNested)
$obj = $stub->value;
$class = $stub->class;

if (\PHP_VERSION_ID < 80000 ? "\0" === ($class[15] ?? null) : false !== strpos($class, "@anonymous\0")) {
if (\PHP_VERSION_ID < 80000 ? "\0" === ($class[15] ?? null) : str_contains($class, "@anonymous\0")) {
$stub->class = get_debug_type($obj);
}
if (isset($this->classInfo[$class])) {
9 changes: 9 additions & 0 deletions Cloner/Data.php
Original file line number Diff line number Diff line change
@@ -155,16 +155,25 @@ public function offsetExists($key)
return $this->__isset($key);
}

/**
* @return mixed
*/
public function offsetGet($key)
{
return $this->__get($key);
}

/**
* @return void
*/
public function offsetSet($key, $value)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}

/**
* @return void
*/
public function offsetUnset($key)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
2 changes: 1 addition & 1 deletion Dumper/AbstractDumper.php
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ public function __construct($output = null, string $charset = null, int $flags =
*/
public function setOutput($output)
{
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
$prev = $this->outputStream ?? $this->lineDumper;

if (\is_callable($output)) {
$this->outputStream = null;
10 changes: 5 additions & 5 deletions Dumper/CliDumper.php
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ public function dumpScalar(Cursor $cursor, string $type, $value)
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;
@@ -324,7 +324,7 @@ public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int
* @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 .= '';
@@ -428,7 +428,7 @@ protected function dumpKey(Cursor $cursor)
*
* @return string The value with style decoration
*/
protected function style($style, $value, $attr = [])
protected function style(string $style, string $value, array $attr = [])
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
@@ -441,7 +441,7 @@ protected function style($style, $value, $attr = [])

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'])) {
@@ -475,7 +475,7 @@ protected function style($style, $value, $attr = [])
} else {
$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";
4 changes: 2 additions & 2 deletions Dumper/ContextProvider/SourceContextProvider.php
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public function getContext(): ?array
$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'];

@@ -98,7 +98,7 @@ public function getContext(): ?array

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);
}
}
Loading