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.4.14
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.4.17
Choose a head ref
  • 3 commits
  • 3 files changed
  • 3 contributors

Commits on Nov 29, 2022

  1. Copy the full SHA
    7fa221f View commit details

Commits on Dec 12, 2022

  1. Copy the full SHA
    312a862 View commit details

Commits on Dec 22, 2022

  1. Copy the full SHA
    ad74890 View commit details
Showing with 17 additions and 7 deletions.
  1. +1 −1 Caster/Caster.php
  2. +1 −1 Caster/ReflectionCaster.php
  3. +15 −5 Tests/Caster/CasterTest.php
2 changes: 1 addition & 1 deletion Caster/Caster.php
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public static function castObject(object $obj, string $class, bool $hasDebugInfo
if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Exception $e) {
} catch (\Throwable $e) {
// ignore failing __debugInfo()
$hasDebugInfo = false;
}
2 changes: 1 addition & 1 deletion Caster/ReflectionCaster.php
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra
self::addMap($a, $c, [
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureScopeClass',
'class' => \PHP_VERSION_ID >= 80111 ? 'getClosureCalledClass' : 'getClosureScopeClass',
'this' => 'getClosureThis',
]);

20 changes: 15 additions & 5 deletions Tests/Caster/CasterTest.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ class CasterTest extends TestCase
{
use VarDumperTestTrait;

private $referenceArray = [
private static $referenceArray = [
'null' => null,
'empty' => false,
'public' => 'pub',
@@ -38,12 +38,12 @@ class CasterTest extends TestCase
public function testFilter($filter, $expectedDiff, $listedProperties = null)
{
if (null === $listedProperties) {
$filteredArray = Caster::filter($this->referenceArray, $filter);
$filteredArray = Caster::filter(self::$referenceArray, $filter);
} else {
$filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties);
$filteredArray = Caster::filter(self::$referenceArray, $filter, $listedProperties);
}

$this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray));
$this->assertSame($expectedDiff, array_diff_assoc(self::$referenceArray, $filteredArray));
}

public function provideFilter()
@@ -126,7 +126,7 @@ public function provideFilter()
],
[
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
$this->referenceArray,
self::$referenceArray,
['public', "\0*\0protected"],
],
[
@@ -175,4 +175,14 @@ public function testAnonymousClass()
, $c
);
}

public function testTypeErrorInDebugInfo()
{
$this->assertDumpMatchesFormat('class@anonymous {}', new class() {
public function __debugInfo(): array
{
return ['class' => \get_class(null)];
}
});
}
}