The expression return $this->getChildBy...array('name' => $name)) could return the type WsdlToPhp\DomHandler\ElementHandler which includes types incompatible with the type-hinted return WsdlToPhp\WsdlHandler\Tag\TagPart|null. Consider adding an additional type-check to rule them out.