Skip to content

Commit 1a3b538

Browse files
committed
[PropertyInfo] Support for the mixed type.
1 parent b95ad41 commit 1a3b538

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private function extractFromReflectionType(\ReflectionType $reflectionType, \Ref
243243

244244
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) {
245245
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type;
246-
if ('null' === $phpTypeOrClass) {
246+
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass) {
247247
continue;
248248
}
249249

src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ public function php80TypesProvider()
221221
['timeout', [new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_FLOAT)]],
222222
['optional', [new Type(Type::BUILTIN_TYPE_INT, true), new Type(Type::BUILTIN_TYPE_FLOAT, true)]],
223223
['string', [new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Stringable'), new Type(Type::BUILTIN_TYPE_STRING)]],
224+
['payload', null],
225+
['data', null],
224226
];
225227
}
226228

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php80Dummy.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ public function getOptional(): int|float|null
2323
public function setString(string|\Stringable $string)
2424
{
2525
}
26+
27+
public function setPayload(mixed $payload)
28+
{
29+
}
30+
31+
public function getData(): mixed
32+
{
33+
}
2634
}

0 commit comments

Comments
 (0)