Skip to content

Commit a627f4f

Browse files
Merge branch '6.4' into 7.0
* 6.4: [HttpKernel] Fix creating `ReflectionMethod` with only one argument [VarDumper] Fix test suite with PHP 8.4 [DoctrineBridge] Add missing return type [Mailer] Fix sendmail transport not handling failure [HttpClient] Lazily initialize CurlClientState updating missing translations for Greek #53768 [Validator] Allow BICs’ first four characters to be digits [ErrorHandler] Fix exit code when an exception occurs and the exception handler has been unregistered [Validator] Review Arabic translations and add correct translations.
2 parents e03ad7c + c62864f commit a627f4f

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

Caster/ReflectionCaster.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,16 @@ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $
116116

117117
public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested): array
118118
{
119-
self::addMap($a, $c, [
119+
$map = [
120120
'name' => 'getName',
121121
'arguments' => 'getArguments',
122-
]);
122+
];
123+
124+
if (\PHP_VERSION_ID >= 80400) {
125+
unset($map['name']);
126+
}
127+
128+
self::addMap($a, $c, $map);
123129

124130
return $a;
125131
}

Tests/Caster/ReflectionCasterTest.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,14 @@ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
531531
public function testReflectionClassWithAttribute()
532532
{
533533
$var = new \ReflectionClass(LotsOfAttributes::class);
534+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
534535

535-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
536+
$this->assertDumpMatchesFormat(<<<EOTXT
536537
ReflectionClass {
537538
+name: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
538539
%A attributes: array:1 [
539540
0 => ReflectionAttribute {
540-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
541+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
541542
arguments: []
542543
}
543544
]
@@ -550,14 +551,15 @@ public function testReflectionClassWithAttribute()
550551
public function testReflectionMethodWithAttribute()
551552
{
552553
$var = new \ReflectionMethod(LotsOfAttributes::class, 'someMethod');
554+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
553555

554-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
556+
$this->assertDumpMatchesFormat(<<<EOTXT
555557
ReflectionMethod {
556558
+name: "someMethod"
557559
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
558560
%A attributes: array:1 [
559561
0 => ReflectionAttribute {
560-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
562+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
561563
arguments: array:1 [
562564
0 => "two"
563565
]
@@ -572,14 +574,15 @@ public function testReflectionMethodWithAttribute()
572574
public function testReflectionPropertyWithAttribute()
573575
{
574576
$var = new \ReflectionProperty(LotsOfAttributes::class, 'someProperty');
577+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
575578

576-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
579+
$this->assertDumpMatchesFormat(<<<EOTXT
577580
ReflectionProperty {
578581
+name: "someProperty"
579582
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
580583
%A attributes: array:1 [
581584
0 => ReflectionAttribute {
582-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
585+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
583586
arguments: array:2 [
584587
0 => "one"
585588
"extra" => "hello"
@@ -594,22 +597,23 @@ public function testReflectionPropertyWithAttribute()
594597
public function testReflectionClassConstantWithAttribute()
595598
{
596599
$var = new \ReflectionClassConstant(LotsOfAttributes::class, 'SOME_CONSTANT');
600+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
597601

598-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
602+
$this->assertDumpMatchesFormat(<<<EOTXT
599603
ReflectionClassConstant {
600604
+name: "SOME_CONSTANT"
601605
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
602606
modifiers: "public"
603607
value: "some value"
604608
attributes: array:2 [
605609
0 => ReflectionAttribute {
606-
name: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
610+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
607611
arguments: array:1 [
608612
0 => "one"
609613
]
610614
}
611615
1 => ReflectionAttribute {
612-
name: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
616+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
613617
arguments: array:1 [
614618
0 => "two"
615619
]
@@ -623,14 +627,15 @@ public function testReflectionClassConstantWithAttribute()
623627
public function testReflectionParameterWithAttribute()
624628
{
625629
$var = new \ReflectionParameter([LotsOfAttributes::class, 'someMethod'], 'someParameter');
630+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
626631

627-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
632+
$this->assertDumpMatchesFormat(<<<EOTXT
628633
ReflectionParameter {
629634
+name: "someParameter"
630635
position: 0
631636
attributes: array:1 [
632637
0 => ReflectionAttribute {
633-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
638+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
634639
arguments: array:1 [
635640
0 => "three"
636641
]

0 commit comments

Comments
 (0)