Skip to content

Commit d314f23

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: fix SQLSRV throws for method_exists() [HttpKernel] Add basic support for language negotiation [Messenger] Add a middleware to log when transaction has been left open [HttpClient] Add method to set response factory in mock client Move array_merge calls out of loops to improve performance Remove references to DBALException [VarDumper] Fix handling of "new" in initializers on PHP 8.1
2 parents 936e773 + 9036cb3 commit d314f23

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Caster/ReflectionCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ public static function getSignature(array $a)
384384
$signature .= 10 > \strlen($v) && !str_contains($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'";
385385
} elseif (\is_bool($v)) {
386386
$signature .= $v ? 'true' : 'false';
387+
} elseif (\is_object($v)) {
388+
$signature .= 'new '.substr(strrchr('\\'.get_debug_type($v), '\\'), 1);
387389
} else {
388390
$signature .= $v;
389391
}

Tests/Caster/ReflectionCasterTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public function testGenerator()
499499
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
500500
› yield 1;
501501
› }
502-
502+
503503
}
504504
}
505505
closed: false
@@ -554,6 +554,27 @@ public function testGenerator()
554554
$this->assertDumpMatchesFormat($expectedDump, $generator);
555555
}
556556

557+
/**
558+
* @requires PHP 8.1
559+
*/
560+
public function testNewInInitializer()
561+
{
562+
$f = eval('return function ($a = new stdClass()) {};');
563+
$line = __LINE__ - 1;
564+
565+
$this->assertDumpMatchesFormat(
566+
<<<EOTXT
567+
Closure(\$a = new stdClass) {
568+
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
569+
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
570+
file: "%sReflectionCasterTest.php($line) : eval()'d code"
571+
line: "1 to 1"
572+
}
573+
EOTXT
574+
, $f
575+
);
576+
}
577+
557578
public function testReflectionClassWithAttribute()
558579
{
559580
$var = new \ReflectionClass(LotsOfAttributes::class);

0 commit comments

Comments
 (0)