mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix psalm
This commit is contained in:
parent
c77cab9cbe
commit
235c9c8281
3 changed files with 4 additions and 3 deletions
|
@ -272,7 +272,7 @@ class PayUponInvoice {
|
|||
}
|
||||
|
||||
$birth_date = filter_input( INPUT_POST, 'billing_birth_date', FILTER_SANITIZE_STRING );
|
||||
if ( ! $this->pui_helper->validate_birth_date( $birth_date ) ) {
|
||||
if ( $birth_date && ! $this->pui_helper->validate_birth_date( $birth_date ) ) {
|
||||
$errors->add( 'validation', __( 'Invalid birth date.', 'woocommerce-paypal-payments' ) );
|
||||
}
|
||||
},
|
||||
|
|
|
@ -33,7 +33,8 @@ class PayUponInvoiceHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( time() < strtotime( '+18 years', strtotime( $date ) ) ) {
|
||||
$date_time = strtotime( $date );
|
||||
if ( $date_time && time() < strtotime( '+18 years', $date_time ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class PayUponInvoiceHelperTest extends TestCase
|
|||
['', false],
|
||||
[(new DateTime())->format($format), false],
|
||||
[(new DateTime('-17 years'))->format($format), false],
|
||||
['31-02-1942', false],
|
||||
['1942-02-31', false],
|
||||
['01-01-1942', false],
|
||||
['1942-01-01', true],
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue