public function getFirstChildOfType($targetType)
{
foreach ($this->nodes as $node) {
if ($node instanceof $targetType) {
return $node;
}
if (($child = $node->getFirstChildOfType($targetType)) !== null) {
return $child;
}
}
$methods = $this->getMethods();
foreach ($methods as $method) {
if (($child = $method->getFirstChildOfType($targetType)) !== null) {
return $child;
}
}
return null;
}