10000 [PropertyInfo] Fixes constructor extractor for mixed type · symfony/symfony@4edd347 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4edd347

Browse files
michael.kubovicfabpot
michael.kubovic
authored andcommitted
[PropertyInfo] Fixes constructor extractor for mixed type
1 parent 8cf82db commit 4edd347

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function getTypesFromConstructor(string $class, string $property): ?array
200200
}
201201
}
202202

203-
if (!isset($types[0])) {
203+
if (!isset($types[0]) || [] === $types[0]) {
204204
return null;
205205
}
206206

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ public function constructorTypesProvider()
443443
['dateObject', [new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTimeInterface')]],
444444
['dateTime', null],
445445
['ddd', null],
446+
['mixed', null],
446447
];
447448
}
448449
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class ConstructorDummy
2929
* @param \DateTimeZone $timezone
3030
* @param int $date Timestamp
3131
* @param \DateTimeInterface $dateObject
32+
* @param mixed $mixed
3233
*/
33-
public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTime $dateTime)
34+
public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTime $dateTime, $mixed)
3435
{
3536
$this->timezone = $timezone->getName();
3637
$this->date = \DateTime::createFromFormat('U', $date);

0 commit comments

Comments
 (0)
0