Skip to content

Commit 9e4ca15

Browse files
Merge branch '7.3' into 7.4
* 7.3: Fix Fix issue with merging union type with a nullable union type
2 parents 9f232d9 + c467722 commit 9e4ca15

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public function endTest($test, $time): void
306306
}
307307

308308
if (self::$expectedDeprecations) {
309-
if (!$test instanceof TestCase || !\in_array($test->getStatus(), [BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE], true)) {
309+
if ($test instanceof TestCase && !\in_array($test->getStatus(), [BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE], true)) {
310310
$test->addToAssertionCount(\count(self::$expectedDeprecations));
311311
}
312312

src/Symfony/Component/TypeInfo/Tests/TypeFactoryTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ public function testCreateNullable()
204204
new NullableType(new UnionType(new BuiltinType(TypeIdentifier::INT), new BuiltinType(TypeIdentifier::STRING))),
205205
Type::union(Type::nullable(Type::int()), Type::string()),
206206
);
207+
$this->assertEquals(
208+
new NullableType(new UnionType(new BuiltinType(TypeIdentifier::INT), new BuiltinType(TypeIdentifier::STRING))),
209+
Type::union(Type::nullable(Type::union(Type::int(), Type::string())), Type::string()),
210+
);
207211
}
208212

209213
public function testCreateArrayShape()

src/Symfony/Component/TypeInfo/TypeFactoryTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,7 @@ public static function union(Type ...$types): UnionType
299299
foreach ($types as $type) {
300300
if ($type instanceof NullableType) {
301301
$nullableUnion = true;
302-
$unionTypes[] = $type->getWrappedType();
303-
304-
continue;
302+
$type = $type->getWrappedType();
305303
}
306304

307305
if ($type instanceof UnionType) {

0 commit comments

Comments
 (0)