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.11
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.13
Choose a head ref
  • 7 commits
  • 3 files changed
  • 2 contributors

Commits on Nov 29, 2021

  1. Fix redundant type casts

    fancyweb committed Nov 29, 2021
    Copy the full SHA
    c29306c View commit details

Commits on Dec 1, 2021

  1. Copy the full SHA
    f2c45f0 View commit details
  2. Merge branch '4.4' into 5.3

    * 4.4:
      [gha] swap the php versions we use in jobs
      [DoctrineBridge] fix calling get_class on non-object
      Update PR template
      [HttpClient] Fix handling error info in MockResponse
    nicolas-grekas committed Dec 1, 2021
    Copy the full SHA
    d139af7 View commit details

Commits on Dec 15, 2021

  1. Copy the full SHA
    478ebd9 View commit details

Commits on Dec 16, 2021

  1. Merge branch '4.4' into 5.3

    * 4.4:
      [Cache] Fix saving items with no expiration through ProxyAdapter
      CS fixes
      [Cache] disable lock on CLI
      [VarDumper] add more "transient-on-macos" groups
    nicolas-grekas committed Dec 16, 2021
    Copy the full SHA
    20fa85c View commit details

Commits on Dec 29, 2021

  1. [CI] Remove macOS jobs

    nicolas-grekas committed Dec 29, 2021
    Copy the full SHA
    02685c6 View commit details
  2. Merge branch '4.4' into 5.3

    * 4.4:
      [DependencyInjection][HttpKernel] Fix enum typed bindings
      [CI] Remove macOS jobs
      Suppress psalm error for UndefinedDocblockClass for PHP 8.1 classes
    nicolas-grekas committed Dec 29, 2021
    Copy the full SHA
    b5710d1 View commit details
Showing with 28 additions and 94 deletions.
  1. +11 −9 Caster/ReflectionCaster.php
  2. +2 −2 Cloner/Data.php
  3. +15 −83 Tests/Caster/ReflectionCasterTest.php
20 changes: 11 additions & 9 deletions Caster/ReflectionCaster.php
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine() - 1,
'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100),
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
@@ -289,15 +289,17 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
unset($a[$prefix.'allowsNull']);
}

try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if ($c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
if ($c->isOptional()) {
try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if ($c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException $e) {
}
} catch (\ReflectionException $e) {
}

return $a;
4 changes: 2 additions & 2 deletions Cloner/Data.php
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ public function __toString()
public function withMaxDepth(int $maxDepth)
{
$data = clone $this;
$data->maxDepth = (int) $maxDepth;
$data->maxDepth = $maxDepth;

return $data;
}
@@ -220,7 +220,7 @@ public function withMaxDepth(int $maxDepth)
public function withMaxItemsPerDepth(int $maxItemsPerDepth)
{
$data = clone $this;
$data->maxItemsPerDepth = (int) $maxItemsPerDepth;
$data->maxItemsPerDepth = $maxItemsPerDepth;

return $data;
}
98 changes: 15 additions & 83 deletions Tests/Caster/ReflectionCasterTest.php
Original file line number Diff line number Diff line change
@@ -138,21 +138,8 @@ public function testReflectionParameter()
{
$var = new \ReflectionParameter(reflectionParameterFixture::class, 0);

if (\PHP_VERSION_ID < 80100) {
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionParameter {
+name: "arg1"
position: 0
typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass"
default: null
}
EOTXT
, $var
);
} else {
$this->assertDumpMatchesFormat(
<<<'EOTXT'
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionParameter {
+name: "arg1"
position: 0
@@ -161,8 +148,7 @@ public function testReflectionParameter()
}
EOTXT
, $var
);
}
);
}

public function testReflectionParameterScalar()
@@ -484,108 +470,54 @@ public function testGenerator()
$generator = new GeneratorDemo();
$generator = $generator->baz();

if (\PHP_VERSION_ID < 80100) {
$expectedDump = <<<'EODUMP'
$expectedDump = <<<'EODUMP'
Generator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
executing: {
%s: {
%sGeneratorDemo.php:14 {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz()
› {
› yield from bar();
› }
}
}
%A}
closed: false
}
EODUMP;
} else {
$expectedDump = <<<'EODUMP'
Generator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
trace: {
./src/Symfony/Component/VarDumper/Tests/Fixtures/GeneratorDemo.php:13 {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz()
› public function baz()
› {
› yield from bar();
}
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {}
}
closed: false
}
EODUMP;
}

$this->assertDumpMatchesFormat($expectedDump, $generator);

foreach ($generator as $v) {
break;
}

if (\PHP_VERSION_ID < 80100) {
$expectedDump = <<<'EODUMP'
$expectedDump = <<<'EODUMP'
array:2 [
0 => ReflectionGenerator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
trace: {
%s%eTests%eFixtures%eGeneratorDemo.php:9 {
%s: {
%s%eTests%eFixtures%eGeneratorDemo.php:%d {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
› {
› yield 1;
› }
}
%A › yield 1;
%A }
%s%eTests%eFixtures%eGeneratorDemo.php:20 { …}
%s%eTests%eFixtures%eGeneratorDemo.php:14 { …}
}
%A }
closed: false
}
1 => Generator {
executing: {
%sGeneratorDemo.php:10 {
%s: {
%s%eTests%eFixtures%eGeneratorDemo.php:%d {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
› yield 1;
› }
}
}
closed: false
}
]
EODUMP;
} else {
$expectedDump = <<<'EODUMP'
array:2 [
0 => ReflectionGenerator {
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
trace: {
%s%eTests%eFixtures%eGeneratorDemo.php:9 {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
› {
› yield 1;
› }
}
%s%eTests%eFixtures%eGeneratorDemo.php:20 { …}
%s%eTests%eFixtures%eGeneratorDemo.php:14 { …}
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {}
}
closed: false
}
1 => Generator {
trace: {
./src/Symfony/Component/VarDumper/Tests/Fixtures/GeneratorDemo.php:9 {
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
› {
› yield 1;
› }
}
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() {}
}
%A }
closed: false
}
]
EODUMP;
}

$r = new \ReflectionGenerator($generator);
$this->assertDumpMatchesFormat($expectedDump, [$r, $r->getExecutingGenerator()]);