@Bitfarmer bugger, once again legacy code bites us. The prototype of the function that was solely an information, gets to be be controlled. The prototype of the function here SHOULD NOT pretend the value is of type x when the code is ready for type x or y. Let's the proto to ignore type.
Change the proto that says
public function __construct(OrderInvoice $order_invoice, $smarty, $bulk_mode = false)
to
public function __construct($order_invoice, $smarty, $bulk_mode = false)
Further code will inclus the fix.