The expression return $this->helperGetO...e10\DetalleMercancia()) could return the type CfdiUtils\Elements\CartaPorte10\Mercancia which is incompatible with the type-hinted return CfdiUtils\Elements\CartaPorte10\DetalleMercancia. Consider adding an additional type-check to rule them out.