Commit b15fbdfaf18 for woocommerce

commit b15fbdfaf1819ed2efff5a302c660e465b5d78d4
Author: Luigi Teschio <gigitux@gmail.com>
Date:   Mon Nov 23 11:46:59 2026 +0100

    Fix PHPStan errors in variation AJAX handlers (#71308)

    * Fix PHPStan errors in variation AJAX handlers

    * Add changelog entry for variation AJAX PHPStan fix

    * Keep integer AJAX error responses

diff --git a/plugins/woocommerce/changelog/fix-variation-ajax-phpstan b/plugins/woocommerce/changelog/fix-variation-ajax-phpstan
new file mode 100644
index 00000000000..9f22d19e91a
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-variation-ajax-phpstan
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Fix PHPStan errors in variation AJAX permission checks while preserving the response.
diff --git a/plugins/woocommerce/includes/class-wc-ajax.php b/plugins/woocommerce/includes/class-wc-ajax.php
index 5cc355fe73c..88a9466f849 100644
--- a/plugins/woocommerce/includes/class-wc-ajax.php
+++ b/plugins/woocommerce/includes/class-wc-ajax.php
@@ -901,6 +901,7 @@ class WC_AJAX {
 			$variation_ids = array_map( 'absint', (array) wp_unslash( $_POST['variation_ids'] ) );

 			if ( ! self::can_edit_variations( $variation_ids ) ) {
+				// @phpstan-ignore argument.type (WordPress accepts integer -1 for AJAX responses, as used by other WooCommerce handlers.)
 				wp_die( -1 );
 			}

@@ -3299,11 +3300,13 @@ class WC_AJAX {

 		$product_id = absint( wp_unslash( $_POST['product_id'] ) );
 		if ( ! current_user_can( 'edit_product', $product_id ) ) {
+			// @phpstan-ignore argument.type (WordPress accepts integer -1 for AJAX responses, as used by other WooCommerce handlers.)
 			wp_die( -1 );
 		}

 		$variation_ids = isset( $_POST['variable_post_id'] ) ? array_map( 'absint', (array) wp_unslash( $_POST['variable_post_id'] ) ) : array();
 		if ( ! self::can_edit_variations( $variation_ids, $product_id ) ) {
+			// @phpstan-ignore argument.type (WordPress accepts integer -1 for AJAX responses, as used by other WooCommerce handlers.)
 			wp_die( -1 );
 		}