Bug #10678

ReflectionService doesn't reflect methods of child classes correctly when they get reflected before their parent class in the initialization process

Added by Florian Kugler almost 11 years ago. Updated almost 10 years ago.

Must have
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


ReflectionService::reflectClass() calls $this->convertParameterReflectionToArray() to reflect the parameters of a method which in turn calls $this->getMethodTagsValues() to retrieve the type hint for the parameter.
However, if a child class gets reflected in the initialization process of ReflectionService before its parent class got reflected, the type hint information for parameters of inherited methods is not detected.

ReflectionService::convertParameterReflectionToArray() tries to retrieve the type hint from the reflection information of the declaring (in this case: parent) class by calling

$methodTagsAndValues = $this->getMethodTagsValues($method->getDeclaringClass()->getName(), $method->getName());

If the declaring class did not get reflected until this point ReflectionService::getMethodTagsValues() returns an empty array.

getMethodTagsValues() only calls reflectClass() on a not yet reflected class it is queried about if the initialization process of the ReflectionService is already finished, because of this statement:
if ($this->initialized === TRUE && !isset($this->reflectedClassNames[$className])) $this->reflectClass($className);

For me removing the $this->initialized === TRUE condition in getMethodTagsValues() solved the problem. But I'm not sure if it might brake things somewhere else!?

No data to display

Also available in: Atom PDF