Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Fix - Update Ukraine state mapping list
* Fix - Use same default locations for Amazon Pay express checkout
* Dev - Add configuration and workflow for PHPStan
* Dev - Improve PHPStan handling of plugin constants

= 10.2.0 - 2025-12-08 =
* Dev - Refactor display logic for payment method issue pills
Expand Down
174 changes: 6 additions & 168 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ parameters:
count: 2
path: includes/abstracts/abstract-wc-stripe-payment-gateway-voucher.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/abstracts/abstract-wc-stripe-payment-gateway-voucher.php

-
message: '#^Method WC_Stripe_Payment_Gateway_Voucher\:\:can_refund_order\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -1026,12 +1020,6 @@ parameters:
count: 3
path: includes/abstracts/abstract-wc-stripe-payment-gateway.php

-
message: '#^Constant WC_STRIPE_PLUGIN_URL not found\.$#'
identifier: constant.notFound
count: 20
path: includes/abstracts/abstract-wc-stripe-payment-gateway.php

-
message: '#^Default value of the parameter \#4 \$previous_error \(false\) of method WC_Stripe_Payment_Gateway\:\:process_subscription_payment\(\) is incompatible with type object\.$#'
identifier: parameter.defaultValue
Expand Down Expand Up @@ -2778,12 +2766,6 @@ parameters:
count: 1
path: includes/admin/class-wc-stripe-admin-notices.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/admin/class-wc-stripe-amazon-pay-controller.php

-
message: '#^Method WC_Stripe_Amazon_Pay_Controller\:\:admin_options\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -2862,12 +2844,6 @@ parameters:
count: 2
path: includes/admin/class-wc-stripe-inbox-notes.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 4
path: includes/admin/class-wc-stripe-inbox-notes.php

-
message: '#^Method WC_Stripe_Inbox_Notes\:\:are_inbox_notes_supported\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -2928,12 +2904,6 @@ parameters:
count: 1
path: includes/admin/class-wc-stripe-inbox-notes.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/admin/class-wc-stripe-payment-gateways-controller.php

-
message: '#^Method WC_Stripe_Payment_Gateways_Controller\:\:enqueue_payments_scripts\(\) has no return type specified\.$#'
identifier: missingType.return
Expand All @@ -2952,12 +2922,6 @@ parameters:
count: 1
path: includes/admin/class-wc-stripe-payment-gateways-controller.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/admin/class-wc-stripe-payment-requests-controller.php

-
message: '#^Method WC_Stripe_Payment_Requests_Controller\:\:admin_options\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -3144,12 +3108,6 @@ parameters:
count: 1
path: includes/admin/class-wc-stripe-rest-oc-setting-toggle-controller.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 2
path: includes/admin/class-wc-stripe-rest-upe-flag-toggle-controller.php

-
message: '#^Method WC_Stripe_REST_UPE_Flag_Toggle_Controller\:\:register_routes\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -3180,12 +3138,6 @@ parameters:
count: 2
path: includes/admin/class-wc-stripe-settings-controller.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/admin/class-wc-stripe-settings-controller.php

-
message: '#^Method WC_Stripe_Settings_Controller\:\:admin_options\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -4452,18 +4404,6 @@ parameters:
count: 1
path: includes/class-wc-stripe-blocks-support.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 2
path: includes/class-wc-stripe-blocks-support.php

-
message: '#^Constant WC_STRIPE_PLUGIN_URL not found\.$#'
identifier: constant.notFound
count: 10
path: includes/class-wc-stripe-blocks-support.php

-
message: '#^Method WC_Stripe_Blocks_Support\:\:__construct\(\) has parameter \$express_checkout_configuration with no type specified\.$#'
identifier: missingType.parameter
Expand Down Expand Up @@ -7125,12 +7065,6 @@ parameters:
count: 1
path: includes/class-wc-stripe.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 125
path: includes/class-wc-stripe.php

-
message: '#^Method WC_Stripe\:\:add_gateways\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -8097,6 +8031,12 @@ parameters:
count: 1
path: includes/connect/class-wc-stripe-connect.php

-
message: '#^Constant WC_Stripe_Express_Checkout_Button_States\:\:STATES type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: includes/constants/class-wc-stripe-express-checkout-button-states.php

-
message: '#^Constant WC_Stripe_Intent_Status\:\:SUCCESSFUL_STATUSES type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -8607,12 +8547,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-alipay.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-alipay.php

-
message: '#^Method WC_Gateway_Stripe_Alipay\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -8745,12 +8679,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-bancontact.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-bancontact.php

-
message: '#^Method WC_Gateway_Stripe_Bancontact\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -8979,12 +8907,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-eps.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-eps.php

-
message: '#^Method WC_Gateway_Stripe_Eps\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -9117,12 +9039,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-giropay.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-giropay.php

-
message: '#^Method WC_Gateway_Stripe_Giropay\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -9255,12 +9171,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-ideal.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-ideal.php

-
message: '#^Method WC_Gateway_Stripe_Ideal\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -9429,12 +9339,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-multibanco.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-multibanco.php

-
message: '#^Method WC_Gateway_Stripe_Multibanco\:\:email_instructions\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -9663,12 +9567,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-p24.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-p24.php

-
message: '#^Method WC_Gateway_Stripe_P24\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -9795,12 +9693,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-sepa.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-sepa.php

-
message: '#^Method WC_Gateway_Stripe_Sepa\:\:form\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -9987,12 +9879,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-sofort.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-gateway-stripe-sofort.php

-
message: '#^Method WC_Gateway_Stripe_Sofort\:\:get_supported_currency\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -10119,12 +10005,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-stripe-express-checkout-ajax-handler.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-stripe-express-checkout-ajax-handler.php

-
message: '#^Method WC_Stripe_Express_Checkout_Ajax_Handler\:\:ajax_add_to_cart\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -10359,18 +10239,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-stripe-express-checkout-element.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-stripe-express-checkout-element.php

-
message: '#^Constant WC_STRIPE_PLUGIN_URL not found\.$#'
identifier: constant.notFound
count: 2
path: includes/payment-methods/class-wc-stripe-express-checkout-element.php

-
message: '#^Method WC_Stripe_Express_Checkout_Element\:\:add_order_meta\(\) has parameter \$posted_data with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -10641,12 +10509,6 @@ parameters:
count: 2
path: includes/payment-methods/class-wc-stripe-express-checkout-helper.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 3
path: includes/payment-methods/class-wc-stripe-express-checkout-helper.php

-
message: '#^Method WC_Stripe_Express_Checkout_Helper\:\:build_display_items\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -11229,12 +11091,6 @@ parameters:
count: 3
path: includes/payment-methods/class-wc-stripe-payment-request.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 3
path: includes/payment-methods/class-wc-stripe-payment-request.php

-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
Expand Down Expand Up @@ -12057,18 +11913,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

-
message: '#^Constant WC_STRIPE_PLUGIN_PATH not found\.$#'
identifier: constant.notFound
count: 2
path: includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

-
message: '#^Constant WC_STRIPE_PLUGIN_URL not found\.$#'
identifier: constant.notFound
count: 2
path: includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

-
message: '#^Method WC_Stripe_UPE_Payment_Gateway\:\:add_bnpl_debug_metadata\(\) has parameter \$metadata with no type specified\.$#'
identifier: missingType.parameter
Expand Down Expand Up @@ -14361,12 +14205,6 @@ parameters:
count: 1
path: includes/payment-methods/class-wc-stripe-upe-payment-method-acss.php

-
message: '#^Constant WC_STRIPE_PLUGIN_URL not found\.$#'
identifier: constant.notFound
count: 1
path: includes/payment-methods/class-wc-stripe-upe-payment-method-afterpay-clearpay.php

-
message: '#^Method WC_Stripe_UPE_Payment_Method_Afterpay_Clearpay\:\:get_title\(\) has parameter \$payment_details with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
21 changes: 21 additions & 0 deletions phpstan-stubs/wc_stripe_constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* Stubs for constants defined via function calls in WooCommerce Stripe that
* PHPStan doesn't seem to pick up correctly. As of 2025-12-24, this is not resolved.
*
* @see https://github.com/phpstan/phpstan/issues/11210
*/

if ( ! defined( 'ABSPATH' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check needed for PHPStan? It might give the impression that this is a WP runtime file.

exit;
}

if ( ! defined( 'WC_STRIPE_PLUGIN_URL' ) ) {
define( 'WC_STRIPE_PLUGIN_URL', 'https://example.com/wp-content/plugins/woocommerce-gateway-stripe' );
}

if ( ! defined( 'WC_STRIPE_PLUGIN_PATH' ) ) {
// This definition is not correct, but we can't use a function like dirname( __DIR__ ) as PHPStan can't resolve it.
define( 'WC_STRIPE_PLUGIN_PATH', __DIR__ );
}
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Fix - Update Ukraine state mapping list
* Fix - Use same default locations for Amazon Pay express checkout
* Dev - Add configuration and workflow for PHPStan
* Dev - Improve PHPStan handling of plugin constants

[See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
Loading