strangerstudios / pmpro-cancel-on-next-payment-date

Change membership cancellation in Paid Memberships Pro to set expiration for next payment date instead of cancelling immediately.
https://www.paidmembershipspro.com/add-ons/cancel-on-next-payment-date
8 stars 8 forks source link

Remove unreachable code #13

Open mircobabini opened 3 years ago

mircobabini commented 3 years ago

I see why there's some unreachable code here: https://github.com/strangerstudios/pmpro-cancel-on-next-payment-date/blob/b01d1b068217d882b90ae4e54f5f2add132dd840/pmpro-cancel-on-next-payment-date.php#L112-L115

This is because we used to check $pmpro_next_payment_timestamp !== false in the past. But now the condition is not strinct: https://github.com/strangerstudios/pmpro-cancel-on-next-payment-date/blob/b01d1b068217d882b90ae4e54f5f2add132dd840/pmpro-cancel-on-next-payment-date.php#L81

So... that code should be unreachable, because $pmpro_next_payment_timestamp != false && empty( $pmpro_next_payment_timestamp ) it's always false.