bug #37983 [PropertyInfo] Fix ReflectionExtractor::getTypesFromConstructor (ogizanagi)

This PR was merged into the 5.2-dev branch.

Discussion
----------

[PropertyInfo] Fix ReflectionExtractor::getTypesFromConstructor

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | N/A

Fixes https://travis-ci.org/github/symfony/symfony/jobs/721953907#L4274-L4296

Relates to #30335

Commits
-------

6423d8a827 [PropertyInfo] Fix ReflectionExtractor::getTypesFromConstructor
This commit is contained in:
Fabien Potencier 2020-08-28 18:21:59 +02:00
commit 6c094cce73

View File

@ -194,11 +194,11 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
if (!$reflectionType = $reflectionParameter->getType()) {
return null;
}
if (!$type = $this->extractFromReflectionType($reflectionType, $reflectionConstructor)) {
if (!$types = $this->extractFromReflectionType($reflectionType, $reflectionConstructor->getDeclaringClass())) {
return null;
}
return [$type];
return $types;
}
private function getReflectionParameterFromConstructor(string $property, \ReflectionMethod $reflectionConstructor): ?\ReflectionParameter