Skip to content

Commit c62864f

Browse files
Merge branch '5.4' into 6.4
* 5.4: [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 b439823 + a078ef2 commit c62864f

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
@@ -128,10 +128,16 @@ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $
128128
*/
129129
public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested)
130130
{
131-
self::addMap($a, $c, [
131+
$map = [
132132
'name' => 'getName',
133133
'arguments' => 'getArguments',
134-
]);
134+
];
135+
136+
if (\PHP_VERSION_ID >= 80400) {
137+
unset($map['name']);
138+
}
139+
140+
self::addMap($a, $c, $map);
135141

136142
return $a;
137143
}

Tests/Caster/ReflectionCasterTest.php

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

538-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
539+
$this->assertDumpMatchesFormat(<<<EOTXT
539540
ReflectionClass {
540541
+name: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
541542
%A attributes: array:1 [
542543
0 => ReflectionAttribute {
543-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
544+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
544545
arguments: []
545546
}
546547
]
@@ -553,14 +554,15 @@ public function testReflectionClassWithAttribute()
553554
public function testReflectionMethodWithAttribute()
554555
{
555556
$var = new \ReflectionMethod(LotsOfAttributes::class, 'someMethod');
557+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
556558

557-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
559+
$this->assertDumpMatchesFormat(<<<EOTXT
558560
ReflectionMethod {
559561
+name: "someMethod"
560562
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
561563
%A attributes: array:1 [
562564
0 => ReflectionAttribute {
563-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
565+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
564566
arguments: array:1 [
565567
0 => "two"
566568
]
@@ -575,14 +577,15 @@ public function testReflectionMethodWithAttribute()
575577
public function testReflectionPropertyWithAttribute()
576578
{
577579
$var = new \ReflectionProperty(LotsOfAttributes::class, 'someProperty');
580+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
578581

579-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
582+
$this->assertDumpMatchesFormat(<<<EOTXT
580583
ReflectionProperty {
581584
+name: "someProperty"
582585
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
583586
%A attributes: array:1 [
584587
0 => ReflectionAttribute {
585-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
588+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
586589
arguments: array:2 [
587590
0 => "one"
588591
"extra" => "hello"
@@ -597,22 +600,23 @@ public function testReflectionPropertyWithAttribute()
597600
public function testReflectionClassConstantWithAttribute()
598601
{
599602
$var = new \ReflectionClassConstant(LotsOfAttributes::class, 'SOME_CONSTANT');
603+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
600604

601-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
605+
$this->assertDumpMatchesFormat(<<<EOTXT
602606
ReflectionClassConstant {
603607
+name: "SOME_CONSTANT"
604608
+class: "Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes"
605609
modifiers: "public"
606610
value: "some value"
607611
attributes: array:2 [
608612
0 => ReflectionAttribute {
609-
name: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
613+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
610614
arguments: array:1 [
611615
0 => "one"
612616
]
613617
}
614618
1 => ReflectionAttribute {
615-
name: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
619+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\RepeatableAttribute"
616620
arguments: array:1 [
617621
0 => "two"
618622
]
@@ -626,14 +630,15 @@ public function testReflectionClassConstantWithAttribute()
626630
public function testReflectionParameterWithAttribute()
627631
{
628632
$var = new \ReflectionParameter([LotsOfAttributes::class, 'someMethod'], 'someParameter');
633+
$dumpedAttributeNameProperty = (\PHP_VERSION_ID < 80400 ? '' : '+').'name';
629634

630-
$this->assertDumpMatchesFormat(<<< 'EOTXT'
635+
$this->assertDumpMatchesFormat(<<<EOTXT
631636
ReflectionParameter {
632637
+name: "someParameter"
633638
position: 0
634639
attributes: array:1 [
635640
0 => ReflectionAttribute {
636-
name: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
641+
$dumpedAttributeNameProperty: "Symfony\Component\VarDumper\Tests\Fixtures\MyAttribute"
637642
arguments: array:1 [
638643
0 => "three"
639644
]

0 commit comments

Comments
 (0)