Commit 7edd5d56c81 for woocommerce
commit 7edd5d56c819019575c131c3aaba3d78748fe4f8
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Mon Sep 28 12:32:47 2026 +0200
Update several WC_Object_Data_Store_Interface doc blocks to fix delete() and delete_meta() return types (#69124)
* Update several WC_Object_Data_Store_Interface doc blocks to fix delete() and delete_meta() return types
* Make changelog a comment
diff --git a/plugins/woocommerce/changelog/fix-30926-improve-WC_Object_Data_Store_Interface-types b/plugins/woocommerce/changelog/fix-30926-improve-WC_Object_Data_Store_Interface-types
new file mode 100644
index 00000000000..49eca739f01
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-30926-improve-WC_Object_Data_Store_Interface-types
@@ -0,0 +1,5 @@
+Significance: patch
+Type: dev
+Comment: Update several WC_Object_Data_Store_Interface doc blocks to fix delete() and delete_meta() return types
+
+
diff --git a/plugins/woocommerce/includes/interfaces/class-wc-object-data-store-interface.php b/plugins/woocommerce/includes/interfaces/class-wc-object-data-store-interface.php
index 397aeb965cd..1affd4ebf80 100644
--- a/plugins/woocommerce/includes/interfaces/class-wc-object-data-store-interface.php
+++ b/plugins/woocommerce/includes/interfaces/class-wc-object-data-store-interface.php
@@ -38,7 +38,7 @@ interface WC_Object_Data_Store_Interface {
*
* @param WC_Data $data Data object.
* @param array $args Array of args to pass to the delete method.
- * @return bool result
+ * @return void
*/
public function delete( &$data, $args = array() );
@@ -53,9 +53,13 @@ interface WC_Object_Data_Store_Interface {
/**
* Deletes meta based on meta ID.
*
+ * Implementations might return different types.
+ * See: https://github.com/woocommerce/woocommerce/issues/30926
+ *
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing at least ->id).
- * @return array
+ *
+ * @phpstan-ignore missingType.return (The return value is intentionally not part of this contract.)
*/
public function delete_meta( &$data, $meta );
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index afa4b58aaaf..94088f246ce 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -10644,7 +10644,6 @@ parameters:
count: 1
path: includes/class-wc-comments.php
-
-
message: '#^Method WC_Countries\:\:country_dropdown_options\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -16669,12 +16668,6 @@ parameters:
count: 1
path: includes/data-stores/abstract-wc-order-data-store-cpt.php
- -
- message: '#^Return type \(void\) of method Abstract_WC_Order_Data_Store_CPT\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: includes/data-stores/abstract-wc-order-data-store-cpt.php
-
-
message: '#^Call to an undefined method WC_Data_Store\:\:delete_metadata\(\)\.$#'
identifier: method.notFound
@@ -16705,12 +16698,6 @@ parameters:
count: 1
path: includes/data-stores/abstract-wc-order-item-type-data-store.php
- -
- message: '#^Method Abstract_WC_Order_Item_Type_Data_Store\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 2
- path: includes/data-stores/abstract-wc-order-item-type-data-store.php
-
-
message: '#^Method Abstract_WC_Order_Item_Type_Data_Store\:\:read\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -16771,18 +16758,6 @@ parameters:
count: 1
path: includes/data-stores/class-wc-coupon-data-store-cpt.php
- -
- message: '#^Method WC_Coupon_Data_Store_CPT\:\:delete\(\) should return bool but empty return statement found\.$#'
- identifier: return.empty
- count: 1
- path: includes/data-stores/class-wc-coupon-data-store-cpt.php
-
- -
- message: '#^Method WC_Coupon_Data_Store_CPT\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 2
- path: includes/data-stores/class-wc-coupon-data-store-cpt.php
-
-
message: '#^Method WC_Coupon_Data_Store_CPT\:\:read\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -16819,12 +16794,6 @@ parameters:
count: 1
path: includes/data-stores/class-wc-customer-data-store-session.php
- -
- message: '#^Method WC_Customer_Data_Store_Session\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 1
- path: includes/data-stores/class-wc-customer-data-store-session.php
-
-
message: '#^Method WC_Customer_Data_Store_Session\:\:read\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -16867,18 +16836,6 @@ parameters:
count: 1
path: includes/data-stores/class-wc-customer-data-store.php
- -
- message: '#^Method WC_Customer_Data_Store\:\:delete\(\) should return bool but empty return statement found\.$#'
- identifier: return.empty
- count: 1
- path: includes/data-stores/class-wc-customer-data-store.php
-
- -
- message: '#^Method WC_Customer_Data_Store\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 1
- path: includes/data-stores/class-wc-customer-data-store.php
-
-
message: '#^Method WC_Customer_Data_Store\:\:get_last_order\(\) should return WC_Order\|false but returns WC_Order\|WC_Order_Refund\|false\.$#'
identifier: return.type
@@ -17527,24 +17484,12 @@ parameters:
count: 1
path: includes/data-stores/class-wc-order-refund-data-store-cpt.php
- -
- message: '#^Return type \(void\) of method WC_Order_Refund_Data_Store_CPT\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: includes/data-stores/class-wc-order-refund-data-store-cpt.php
-
-
message: '#^Method WC_Payment_Token_Data_Store\:\:create\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: includes/data-stores/class-wc-payment-token-data-store.php
- -
- message: '#^Method WC_Payment_Token_Data_Store\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 1
- path: includes/data-stores/class-wc-payment-token-data-store.php
-
-
message: '#^Method WC_Payment_Token_Data_Store\:\:read\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -17623,18 +17568,6 @@ parameters:
count: 1
path: includes/data-stores/class-wc-product-data-store-cpt.php
- -
- message: '#^Method WC_Product_Data_Store_CPT\:\:delete\(\) should return bool but empty return statement found\.$#'
- identifier: return.empty
- count: 1
- path: includes/data-stores/class-wc-product-data-store-cpt.php
-
- -
- message: '#^Method WC_Product_Data_Store_CPT\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 2
- path: includes/data-stores/class-wc-product-data-store-cpt.php
-
-
message: '#^Parameter \#1 \$amount of function wc_stock_amount expects float\|int, float\|int\|null given\.$#'
identifier: argument.type
@@ -17887,12 +17820,6 @@ parameters:
count: 3
path: includes/data-stores/class-wc-shipping-zone-data-store.php
- -
- message: '#^Return type \(void\) of method WC_Shipping_Zone_Data_Store\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: includes/data-stores/class-wc-shipping-zone-data-store.php
-
-
message: '#^Binary operation "\." between ''AND `date_created…'' and array\|string results in an error\.$#'
identifier: binaryOp.invalid
@@ -44824,18 +44751,6 @@ parameters:
count: 1
path: src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php
- -
- message: '#^Return type \(void\) of method Automattic\\WooCommerce\\Admin\\Features\\Fulfillments\\DataStore\\FulfillmentsDataStore\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php
-
- -
- message: '#^Return type \(void\) of method Automattic\\WooCommerce\\Admin\\Features\\Fulfillments\\DataStore\\FulfillmentsDataStore\:\:delete_meta\(\) should be compatible with return type \(array\) of method WC_Object_Data_Store_Interface\:\:delete_meta\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php
-
-
message: '#^Call to function is_object\(\) with ''''\|''0''\|array will always evaluate to false\.$#'
identifier: function.impossibleType
@@ -46192,12 +46107,6 @@ parameters:
count: 1
path: src/Admin/Notes/DataStore.php
- -
- message: '#^Method Automattic\\WooCommerce\\Admin\\Notes\\DataStore\:\:delete\(\) should return bool but return statement is missing\.$#'
- identifier: return.missing
- count: 1
- path: src/Admin/Notes/DataStore.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\Notes\\DataStore\:\:read\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -60505,18 +60414,6 @@ parameters:
count: 1
path: src/Internal/DataStores/Orders/OrdersTableDataStore.php
- -
- message: '#^Return type \(bool\) of method Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore\:\:delete_meta\(\) should be compatible with return type \(array\) of method WC_Object_Data_Store_Interface\:\:delete_meta\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Internal/DataStores/Orders/OrdersTableDataStore.php
-
- -
- message: '#^Return type \(void\) of method Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Internal/DataStores/Orders/OrdersTableDataStore.php
-
-
message: '#^Variable \$ids in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
@@ -60733,12 +60630,6 @@ parameters:
count: 1
path: src/Internal/DataStores/Orders/OrdersTableRefundDataStore.php
- -
- message: '#^Return type \(void\) of method Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableRefundDataStore\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Internal/DataStores/Orders/OrdersTableRefundDataStore.php
-
-
message: '#^Binary operation "\." between ''\\'''' and non\-empty\-array\|string results in an error\.$#'
identifier: binaryOp.invalid
@@ -60829,18 +60720,6 @@ parameters:
count: 1
path: src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php
- -
- message: '#^Return type \(bool\) of method Automattic\\WooCommerce\\Internal\\DataStores\\StockNotifications\\StockNotificationsDataStore\:\:delete_meta\(\) should be compatible with return type \(array\) of method WC_Object_Data_Store_Interface\:\:delete_meta\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php
-
- -
- message: '#^Return type \(void\) of method Automattic\\WooCommerce\\Internal\\DataStores\\StockNotifications\\StockNotificationsDataStore\:\:delete\(\) should be compatible with return type \(bool\) of method WC_Object_Data_Store_Interface\:\:delete\(\)$#'
- identifier: method.childReturnType
- count: 1
- path: src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php
-
-
message: '#^Parameter \#1 \$message of method Exception\:\:__construct\(\) expects string, null given\.$#'
identifier: argument.type