Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad0bb7b

Browse files
committed
fix extracting mixed type-hinted property types
1 parentdc20a31 commitad0bb7b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ public function getTypes($class, $property, array $context = []): ?array
162162
try {
163163
$reflectionProperty =new \ReflectionProperty($class,$property);
164164
$type =$reflectionProperty->getType();
165-
if (null !==$type) {
166-
return$this->extractFromReflectionType($type,$reflectionProperty->getDeclaringClass());
165+
if (null !==$type &&$types =$this->extractFromReflectionType($type,$reflectionProperty->getDeclaringClass())) {
166+
return$types;
167167
}
168168
}catch (\ReflectionException$e) {
169169
// noop

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public function php80TypesProvider()
239239
['string', [newType(Type::BUILTIN_TYPE_OBJECT,false,'Stringable'),newType(Type::BUILTIN_TYPE_STRING)]],
240240
['payload',null],
241241
['data',null],
242+
['mixedProperty',null],
242243
];
243244
}
244245

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class Php80Dummy
66
{
7+
publicmixed$mixedProperty;
8+
79
publicfunctiongetFoo():array|null
810
{
911
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp