mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 16:24:33 +08:00
Merge pull request #2229 from woocommerce/PCP-3116-psalm-errors-after-updating-wc-stubs
psalm errors after updating wc stubs (3116)
This commit is contained in:
commit
fa3aa8167c
4 changed files with 253 additions and 211 deletions
|
@ -22,7 +22,7 @@
|
|||
"phpunit/phpunit": "^7.0 | ^8.0 | ^9.0",
|
||||
"brain/monkey": "^2.4",
|
||||
"php-stubs/wordpress-stubs": "^5.0@stable",
|
||||
"php-stubs/woocommerce-stubs": "^5.0@stable",
|
||||
"php-stubs/woocommerce-stubs": "^8.0@stable",
|
||||
"vimeo/psalm": "^4.0",
|
||||
"vlucas/phpdotenv": "^5"
|
||||
},
|
||||
|
|
440
composer.lock
generated
440
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -620,13 +620,18 @@ class ApplePayButton implements ButtonInterface {
|
|||
): array {
|
||||
|
||||
$shipping_methods_array = array();
|
||||
$shipping_methods = WC()->shipping->calculate_shipping(
|
||||
/**
|
||||
* The argument is defined only in docblock.
|
||||
*
|
||||
* @psalm-suppress InvalidScalarArgument
|
||||
*/
|
||||
$shipping_methods = WC()->shipping->calculate_shipping(
|
||||
$this->getShippingPackages(
|
||||
$customer_address,
|
||||
$cart->get_total( 'edit' )
|
||||
)
|
||||
);
|
||||
$done = false;
|
||||
$done = false;
|
||||
foreach ( $shipping_methods[0]['rates'] as $rate ) {
|
||||
$shipping_methods_array[] = array(
|
||||
'label' => $rate->get_label(),
|
||||
|
|
|
@ -28,13 +28,18 @@ class DeactivateNote {
|
|||
/**
|
||||
* Note initialization.
|
||||
*/
|
||||
public static function init() {
|
||||
public static function init(): void {
|
||||
if ( ! PPECHelper::is_plugin_active() ) {
|
||||
self::maybe_mark_note_as_actioned();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* The method exists in the NoteTraits trait.
|
||||
*
|
||||
* @psalm-suppress UndefinedMethod
|
||||
*/
|
||||
self::possibly_add_note();
|
||||
} catch ( \Exception $e ) {
|
||||
return;
|
||||
|
@ -44,7 +49,7 @@ class DeactivateNote {
|
|||
/**
|
||||
* Get the note.
|
||||
*
|
||||
* @return Automatic\WooCommerce\Admin\Notes\Note
|
||||
* @return Note
|
||||
*/
|
||||
public static function get_note() {
|
||||
if ( PPECHelper::site_has_ppec_subscriptions() ) {
|
||||
|
@ -87,7 +92,7 @@ class DeactivateNote {
|
|||
/**
|
||||
* Marks the inbox note as actioned so that it doesn't re-appear.
|
||||
*/
|
||||
private static function maybe_mark_note_as_actioned() {
|
||||
private static function maybe_mark_note_as_actioned(): void {
|
||||
try {
|
||||
$data_store = \WC_Data_Store::load( 'admin-note' );
|
||||
} catch ( \Exception $e ) {
|
||||
|
@ -106,7 +111,7 @@ class DeactivateNote {
|
|||
|
||||
$note = Notes::get_note( $note_ids[0] );
|
||||
|
||||
if ( Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) {
|
||||
if ( $note instanceof Note && Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) {
|
||||
$note->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
|
||||
$note->save();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue