This check is not needed. Checking if the payment is not null should be enough, because it can be only PaymentInterface or null. (see the Order / OrderInterface)