Skip to content

Commit 4d7cb8e

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Fix CS quote address names if they contain parentheses [FrameworkBundle] Fail gracefully when forms use disabled CSRF [Mime] Fix inline parts when added via attachPart() Fail gracefully when attempting to autowire composite types [VarDumper] Add a test case for nesting intersection and union types
2 parents a09f9fc + 72d4d41 commit 4d7cb8e

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

Tests/Caster/ReflectionCasterTest.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionIntersectionTypeFixture;
2222
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionNamedTypeFixture;
2323
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeFixture;
24+
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeWithIntersectionFixture;
2425

2526
/**
2627
* @author Nicolas Grekas <[email protected]>
@@ -94,7 +95,7 @@ public function testClosureCaster()
9495
$b: & 123
9596
}
9697
file: "%sReflectionCasterTest.php"
97-
line: "87 to 87"
98+
line: "88 to 88"
9899
}
99100
EOTXT
100101
, $var
@@ -342,6 +343,44 @@ public function testReflectionIntersectionType()
342343
);
343344
}
344345

346+
/**
347+
* @requires PHP 8.2
348+
*/
349+
public function testReflectionUnionTypeWithIntersection()
350+
{
351+
$var = (new \ReflectionProperty(ReflectionUnionTypeWithIntersectionFixture::class, 'a'))->getType();
352+
$this->assertDumpMatchesFormat(
353+
<<<'EOTXT'
354+
ReflectionUnionType {
355+
allowsNull: true
356+
types: array:2 [
357+
0 => ReflectionIntersectionType {
358+
allowsNull: false
359+
types: array:2 [
360+
0 => ReflectionNamedType {
361+
name: "Traversable"
362+
allowsNull: false
363+
isBuiltin: false
364+
}
365+
1 => ReflectionNamedType {
366+
name: "Countable"
367+
allowsNull: false
368+
isBuiltin: false
369+
}
370+
]
371+
}
372+
1 => ReflectionNamedType {
373+
name: "null"
374+
allowsNull: true
375+
isBuiltin: true
376+
}
377+
]
378+
}
379+
EOTXT
380+
, $var
381+
);
382+
}
383+
345384
/**
346385
* @requires PHP 8
347386
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Symfony\Component\VarDumper\Tests\Fixtures;
4+
5+
class ReflectionUnionTypeWithIntersectionFixture
6+
{
7+
public (\Traversable&\Countable)|null $a;
8+
}

0 commit comments

Comments
 (0)