Commit 20c087cab1 for woocommerce
commit 20c087cab1bde5bfc06b02539e23a3aac5231b35
Author: Sam Seay <samueljseay@gmail.com>
Date: Fri Jan 16 00:48:20 2026 +1300
Stub WC constants for PHPStan, establish new baseline. (#62804)
diff --git a/plugins/woocommerce/includes/class-woocommerce.php b/plugins/woocommerce/includes/class-woocommerce.php
index 34cdd14483..d2c88f7099 100644
--- a/plugins/woocommerce/includes/class-woocommerce.php
+++ b/plugins/woocommerce/includes/class-woocommerce.php
@@ -471,6 +471,9 @@ final class WooCommerce {
/**
* Define WC Constants.
+ *
+ * IMPORTANT: When adding new constants here, also add them to
+ * php-stubs/wc-constants.php for PHPStan static analysis.
*/
private function define_constants() {
$this->define( 'WC_ABSPATH', dirname( WC_PLUGIN_FILE ) . '/' );
diff --git a/plugins/woocommerce/php-stubs/wc-constants.php b/plugins/woocommerce/php-stubs/wc-constants.php
new file mode 100644
index 0000000000..5b5b7079c3
--- /dev/null
+++ b/plugins/woocommerce/php-stubs/wc-constants.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Stub file for WooCommerce constants.
+ *
+ * These constants are defined at runtime via WooCommerce::define() which PHPStan
+ * cannot statically analyze. This stub provides the definitions so PHPStan can
+ * properly validate code that uses these constants.
+ *
+ * @see \WooCommerce::define_constants()
+ * @see \Automattic\WooCommerce\Internal\Admin\FeaturePlugin::define_constants()
+ */
+
+// Core WooCommerce constants (defined in class-woocommerce.php).
+define( 'WC_ABSPATH', '' );
+define( 'WC_PLUGIN_BASENAME', '' );
+define( 'WC_VERSION', '' );
+define( 'WOOCOMMERCE_VERSION', '' );
+define( 'WC_ROUNDING_PRECISION', 6 );
+define( 'WC_DISCOUNT_ROUNDING_MODE', 2 );
+define( 'WC_TAX_ROUNDING_MODE', 1 );
+define( 'WC_DELIMITER', '|' );
+define( 'WC_SESSION_CACHE_GROUP', 'wc_session_id' );
+define( 'WC_TEMPLATE_DEBUG_MODE', false );
+define( 'WC_LOG_DIR', '' );
+define( 'WC_NOTICE_MIN_PHP_VERSION', '7.2' );
+define( 'WC_NOTICE_MIN_WP_VERSION', '5.2' );
+define( 'WC_PHP_MIN_REQUIREMENTS_NOTICE', '' );
+define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'none' );
+
+// Admin constants (defined in FeaturePlugin.php).
+define( 'WC_ADMIN_ABSPATH', '' );
+define( 'WC_ADMIN_APP', '' );
+define( 'WC_ADMIN_DIST_CSS_FOLDER', '' );
+define( 'WC_ADMIN_DIST_JS_FOLDER', '' );
+define( 'WC_ADMIN_IMAGES_FOLDER_URL', '' );
+define( 'WC_ADMIN_PLUGIN_FILE', '' );
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 752dc88eb4..38de72da49 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -672,18 +672,6 @@ parameters:
count: 1
path: includes/abstracts/abstract-wc-order.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/abstracts/abstract-wc-order.php
-
- -
- message: '#^Constant WC_ROUNDING_PRECISION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/abstracts/abstract-wc-order.php
-
-
message: '#^Method WC_Abstract_Order\:\:add_order_item_totals_discount_row\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -1176,12 +1164,6 @@ parameters:
count: 2
path: includes/abstracts/abstract-wc-payment-token.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/abstracts/abstract-wc-payment-token.php
-
-
message: '#^Method WC_Payment_Token\:\:set_default\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -1242,12 +1224,6 @@ parameters:
count: 1
path: includes/abstracts/abstract-wc-product.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/abstracts/abstract-wc-product.php
-
-
message: '#^Method WC_Product\:\:after_data_store_save_or_update\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -2004,24 +1980,6 @@ parameters:
count: 1
path: includes/admin/class-wc-admin-api-keys.php
- -
- message: '#^Constant WC_ADMIN_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-assets.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_JS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-assets.php
-
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/admin/class-wc-admin-assets.php
-
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
@@ -2550,12 +2508,6 @@ parameters:
count: 1
path: includes/admin/class-wc-admin-duplicate-product.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/admin/class-wc-admin-exporters.php
-
-
message: '#^Method WC_Admin_Exporters\:\:add_to_menus\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -2640,12 +2592,6 @@ parameters:
count: 1
path: includes/admin/class-wc-admin-help.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/admin/class-wc-admin-importers.php
-
-
message: '#^Method WC_Admin_Importers\:\:add_to_menus\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -3054,30 +3000,6 @@ parameters:
count: 1
path: includes/admin/class-wc-admin-meta-boxes.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-notices.php
-
- -
- message: '#^Constant WC_NOTICE_MIN_PHP_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-notices.php
-
- -
- message: '#^Constant WC_NOTICE_MIN_WP_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-notices.php
-
- -
- message: '#^Constant WC_PHP_MIN_REQUIREMENTS_NOTICE not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-notices.php
-
-
message: '#^Method WC_Admin_Notices\:\:add_custom_notice\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -4308,12 +4230,6 @@ parameters:
count: 4
path: includes/admin/class-wc-admin-taxonomies.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin-taxonomies.php
-
-
message: '#^Method WC_Admin_Taxonomies\:\:add_category_fields\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -4548,12 +4464,6 @@ parameters:
count: 1
path: includes/admin/class-wc-admin.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/class-wc-admin.php
-
-
message: '#^Method WC_Admin\:\:admin_redirects\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -5484,12 +5394,6 @@ parameters:
count: 1
path: includes/admin/importers/class-wc-product-csv-importer-controller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/importers/class-wc-product-csv-importer-controller.php
-
-
message: '#^Method WC_Product_CSV_Importer_Controller\:\:add_error\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -7578,12 +7482,6 @@ parameters:
count: 1
path: includes/admin/meta-boxes/views/html-product-data-general.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/meta-boxes/views/html-product-data-inventory.php
-
-
message: '#^One or more @param tags has an invalid name or invalid syntax\.$#'
identifier: phpDoc.parseError
@@ -7674,12 +7572,6 @@ parameters:
count: 5
path: includes/admin/meta-boxes/views/html-product-data-shipping.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/admin/meta-boxes/views/html-product-data-variations.php
-
-
message: '#^Parameter \#1 \$json of function wc_esc_json expects string, string\|false given\.$#'
identifier: argument.type
@@ -8802,12 +8694,6 @@ parameters:
count: 1
path: includes/admin/reports/class-wc-report-taxes-by-date.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/settings/class-wc-settings-accounts.php
-
-
message: '#^Method WC_Settings_Accounts\:\:output\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -8952,12 +8838,6 @@ parameters:
count: 1
path: includes/admin/settings/class-wc-settings-emails.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/settings/class-wc-settings-general.php
-
-
message: '#^Method WC_Settings_General\:\:color_picker\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -9636,12 +9516,6 @@ parameters:
count: 1
path: includes/admin/views/html-notice-custom.php
- -
- message: '#^Constant WC_PHP_MIN_REQUIREMENTS_NOTICE not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/admin/views/html-notice-wp-php-minimum-requirements.php
-
-
message: '#^Variable \$msg might not be defined\.$#'
identifier: variable.undefined
@@ -12630,12 +12504,6 @@ parameters:
count: 2
path: includes/class-wc-cart.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/class-wc-cart.php
-
-
message: '#^Method WC_Cart\:\:add_fee\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -15198,12 +15066,6 @@ parameters:
count: 1
path: includes/class-wc-form-handler.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 4
- path: includes/class-wc-frontend-scripts.php
-
-
message: '#^Default value of the parameter \#5 \$in_footer \(array\<string, string\>\) of method WC_Frontend_Scripts\:\:enqueue_script\(\) is incompatible with type bool\.$#'
identifier: parameter.defaultValue
@@ -15402,12 +15264,6 @@ parameters:
count: 2
path: includes/class-wc-install.php
- -
- message: '#^Constant WC_PLUGIN_BASENAME not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/class-wc-install.php
-
-
message: '#^Function as_schedule_single_action not found\.$#'
identifier: function.notFound
@@ -18330,12 +18186,6 @@ parameters:
count: 1
path: includes/class-wc-regenerate-images.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/class-wc-regenerate-images.php
-
-
message: '#^Function remove_action invoked with 4 parameters, 2\-3 required\.$#'
identifier: arguments.count
@@ -18690,18 +18540,6 @@ parameters:
count: 1
path: includes/class-wc-session-handler.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/class-wc-session-handler.php
-
- -
- message: '#^Constant WC_SESSION_CACHE_GROUP not found\.$#'
- identifier: constant.notFound
- count: 6
- path: includes/class-wc-session-handler.php
-
-
message: '#^Method WC_Session_Handler\:\:cleanup_sessions\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -19950,12 +19788,6 @@ parameters:
count: 12
path: includes/class-wc-template-loader.php
- -
- message: '#^Constant WC_TEMPLATE_DEBUG_MODE not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/class-wc-template-loader.php
-
-
message: '#^Method WC_Template_Loader\:\:add_support_for_product_page_gallery\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -20370,30 +20202,6 @@ parameters:
count: 1
path: includes/class-woocommerce.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 143
- path: includes/class-woocommerce.php
-
- -
- message: '#^Constant WC_NOTICE_MIN_PHP_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/class-woocommerce.php
-
- -
- message: '#^Constant WC_NOTICE_MIN_WP_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/class-woocommerce.php
-
- -
- message: '#^Constant WC_PLUGIN_BASENAME not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/class-woocommerce.php
-
-
message: '#^Function as_next_scheduled_action not found\.$#'
identifier: function.notFound
@@ -20964,12 +20772,6 @@ parameters:
count: 4
path: includes/cli/class-wc-cli-update-command.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/cli/class-wc-cli-update-command.php
-
-
message: '#^Method WC_CLI_Update_Command\:\:register_commands\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -20988,18 +20790,6 @@ parameters:
count: 1
path: includes/customizer/class-wc-shop-customizer.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/customizer/class-wc-shop-customizer.php
-
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/customizer/class-wc-shop-customizer.php
-
-
message: '#^Method WC_Shop_Customizer\:\:add_checkout_section\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -23760,12 +23550,6 @@ parameters:
count: 2
path: includes/emails/class-wc-email.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/emails/class-wc-email.php
-
-
message: '#^Method WC_Email\:\:admin_actions\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -23910,12 +23694,6 @@ parameters:
count: 1
path: includes/emails/class-wc-email.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/export/abstract-wc-csv-batch-exporter.php
-
-
message: '#^Method WC_CSV_Batch_Exporter\:\:export\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -24078,12 +23856,6 @@ parameters:
count: 2
path: includes/export/class-wc-product-csv-exporter.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/export/class-wc-product-csv-exporter.php
-
-
message: '#^Method WC_Product\:\:get_children\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
@@ -24990,12 +24762,6 @@ parameters:
count: 1
path: includes/import/abstract-wc-product-importer.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/import/abstract-wc-product-importer.php
-
-
message: '#^Method WC_Product_Importer\:\:set_image_data\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -25050,12 +24816,6 @@ parameters:
count: 3
path: includes/import/class-wc-product-csv-importer.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/import/class-wc-product-csv-importer.php
-
-
message: '#^Method WC_Product_CSV_Importer\:\:adjust_character_encoding\(\) should return string but returns string\|false\.$#'
identifier: return.type
@@ -25182,12 +24942,6 @@ parameters:
count: 1
path: includes/integrations/maxmind-geolocation/class-wc-integration-maxmind-geolocation.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/integrations/maxmind-geolocation/class-wc-integration-maxmind-geolocation.php
-
-
message: '#^Method WC_Integration_MaxMind_Geolocation\:\:add_missing_license_key_notice\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -27390,12 +27144,6 @@ parameters:
count: 1
path: includes/payment-tokens/class-wc-payment-token-echeck.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/product-usage/class-wc-product-usage.php
-
-
message: '#^Method WC_Product_Usage\:\:includes\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -29550,12 +29298,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
-
-
message: '#^Dead catch \- WC_REST_Exception is already caught above\.$#'
identifier: catch.alreadyCaught
@@ -29790,12 +29532,6 @@ parameters:
count: 2
path: includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
- -
- message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_options\(\) expects array, array\<mixed\>\|false given\.$#'
- identifier: argument.type
- count: 1
- path: includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
-
-
message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_position\(\) expects int, string given\.$#'
identifier: argument.type
@@ -30852,12 +30588,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php
-
-
message: '#^Dead catch \- WC_REST_Exception is already caught above\.$#'
identifier: catch.alreadyCaught
@@ -31920,12 +31650,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
-
-
message: '#^Method WC_REST_Products_V2_Controller\:\:batch_items\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -32100,12 +31824,6 @@ parameters:
count: 2
path: includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
- -
- message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_options\(\) expects array, array\<mixed\>\|false given\.$#'
- identifier: argument.type
- count: 1
- path: includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php
-
-
message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_position\(\) expects int, string given\.$#'
identifier: argument.type
@@ -33576,12 +33294,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php
-
-
message: '#^Method WC_REST_Orders_Controller\:\:calculate_coupons\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -33666,12 +33378,6 @@ parameters:
count: 2
path: includes/rest-api/Controllers/Version3/class-wc-rest-paypal-buttons-controller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/rest-api/Controllers/Version3/class-wc-rest-paypal-buttons-controller.php
-
-
message: '#^Method WC_REST_Paypal_Buttons_Controller\:\:cancel_payment\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -33768,12 +33474,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version3/class-wc-rest-paypal-standard-controller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/rest-api/Controllers/Version3/class-wc-rest-paypal-standard-controller.php
-
-
message: '#^Method WC_REST_Paypal_Standard_Controller\:\:process_shipping_callback\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -35175,12 +34875,6 @@ parameters:
count: 1
path: includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php
-
-
message: '#^Method WC_Product\:\:has_options\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
@@ -35343,12 +35037,6 @@ parameters:
count: 2
path: includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php
- -
- message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_options\(\) expects array, array\<mixed\>\|false given\.$#'
- identifier: argument.type
- count: 1
- path: includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php
-
-
message: '#^Parameter \#1 \$value of method WC_Product_Attribute\:\:set_position\(\) expects int, string given\.$#'
identifier: argument.type
@@ -36105,24 +35793,12 @@ parameters:
count: 1
path: includes/rest-api/Package.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/rest-api/Package.php
-
-
message: '#^Method Automattic\\WooCommerce\\RestApi\\Package\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: includes/rest-api/Package.php
- -
- message: '#^PHPDoc tag @var for constant Automattic\\WooCommerce\\RestApi\\Package\:\:VERSION with type string is not subtype of value mixed\.$#'
- identifier: classConstant.phpDocType
- count: 1
- path: includes/rest-api/Package.php
-
-
message: '#^Call to an undefined method object\:\:register_routes\(\)\.$#'
identifier: method.notFound
@@ -36249,12 +35925,6 @@ parameters:
count: 1
path: includes/shipping/free-shipping/class-wc-shipping-free-shipping.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/shipping/free-shipping/class-wc-shipping-free-shipping.php
-
-
message: '#^Method WC_Shipping_Free_Shipping\:\:calculate_shipping\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -36315,12 +35985,6 @@ parameters:
count: 1
path: includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php
-
-
message: '#^Function remove_shortcode invoked with 2 parameters, 1 required\.$#'
identifier: arguments.count
@@ -37173,12 +36837,6 @@ parameters:
count: 1
path: includes/tracks/class-wc-site-tracking.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 12
- path: includes/tracks/class-wc-site-tracking.php
-
-
message: '#^Method WC_Site_Tracking\:\:add_enable_tracking_function\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -37317,12 +36975,6 @@ parameters:
count: 1
path: includes/tracks/class-wc-tracks.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/tracks/class-wc-tracks.php
-
-
message: '#^Method WC_Tracks\:\:track_woocommerce_allow_tracking_toggled\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -37431,12 +37083,6 @@ parameters:
count: 1
path: includes/tracks/events/class-wc-coupon-tracking.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/tracks/events/class-wc-coupons-tracking.php
-
-
message: '#^Method WC_Coupons_Tracking\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -37815,18 +37461,6 @@ parameters:
count: 1
path: includes/tracks/events/class-wc-products-tracking.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/tracks/events/class-wc-products-tracking.php
-
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/tracks/events/class-wc-products-tracking.php
-
-
message: '#^Method WC_Products_Tracking\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -37947,12 +37581,6 @@ parameters:
count: 1
path: includes/tracks/events/class-wc-settings-tracking.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/tracks/events/class-wc-status-tracking.php
-
-
message: '#^Method WC_Status_Tracking\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -38223,12 +37851,6 @@ parameters:
count: 1
path: includes/wc-attribute-functions.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/wc-attribute-functions.php
-
-
message: '#^Default value of the parameter \#2 \$product \(string\) of function wc_attribute_label\(\) is incompatible with type WC_Product\.$#'
identifier: parameter.defaultValue
@@ -38463,36 +38085,6 @@ parameters:
count: 1
path: includes/wc-core-functions.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 19
- path: includes/wc-core-functions.php
-
- -
- message: '#^Constant WC_DISCOUNT_ROUNDING_MODE not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/wc-core-functions.php
-
- -
- message: '#^Constant WC_ROUNDING_PRECISION not found\.$#'
- identifier: constant.notFound
- count: 2
- path: includes/wc-core-functions.php
-
- -
- message: '#^Constant WC_TAX_ROUNDING_MODE not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/wc-core-functions.php
-
- -
- message: '#^Constant WC_TEMPLATE_DEBUG_MODE not found\.$#'
- identifier: constant.notFound
- count: 3
- path: includes/wc-core-functions.php
-
-
message: '#^Function flush_rewrite_rules_on_shop_page_save\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -40293,12 +39885,6 @@ parameters:
count: 1
path: includes/wc-formatting-functions.php
- -
- message: '#^Constant WC_TAX_ROUNDING_MODE not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/wc-formatting-functions.php
-
-
message: '#^Function wc_format_decimal\(\) should return string but returns array\<string\>\|string\|null\.$#'
identifier: return.type
@@ -43527,12 +43113,6 @@ parameters:
count: 1
path: includes/wccom-site/class-wc-wccom-site.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 19
- path: includes/wccom-site/class-wc-wccom-site.php
-
-
message: '#^Method WC_WCCOM_Site\:\:authenticate_wccom\(\) should return int\|false but returns WP_User\.$#'
identifier: return.type
@@ -44055,12 +43635,6 @@ parameters:
count: 2
path: includes/widgets/class-wc-widget-brand-nav.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/widgets/class-wc-widget-brand-nav.php
-
-
message: '#^Method WC_Widget_Brand_Nav\:\:filter_out_cats\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -44169,12 +43743,6 @@ parameters:
count: 1
path: includes/widgets/class-wc-widget-layered-nav.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/widgets/class-wc-widget-layered-nav.php
-
-
message: '#^Method WC_Widget_Layered_Nav\:\:init_settings\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -44259,12 +43827,6 @@ parameters:
count: 1
path: includes/widgets/class-wc-widget-price-filter.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: includes/widgets/class-wc-widget-product-categories.php
-
-
message: '#^Method WC_Widget_Product_Categories\:\:widget\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -44715,12 +44277,6 @@ parameters:
count: 1
path: src/Admin/API/Init.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/API/Init.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\API\\Init\:\:add_currency_symbol_to_order_response\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -46053,12 +45609,6 @@ parameters:
count: 1
path: src/Admin/API/OnboardingProfile.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/API/OnboardingProfile.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\API\\OnboardingProfile\:\:core_profiler_step_complete\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -46245,18 +45795,6 @@ parameters:
count: 1
path: src/Admin/API/OnboardingTasks.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 4
- path: src/Admin/API/OnboardingTasks.php
-
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/API/OnboardingTasks.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\API\\OnboardingTasks\:\:action_task\(\) has invalid return type Automattic\\WooCommerce\\Admin\\API\\WP_Error\.$#'
identifier: class.notFound
@@ -47001,12 +46539,6 @@ parameters:
count: 1
path: src/Admin/API/Plugins.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 5
- path: src/Admin/API/Plugins.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\API\\Plugins\:\:activate_plugins\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -47085,12 +46617,6 @@ parameters:
count: 1
path: src/Admin/API/ProductAttributeTerms.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/API/ProductAttributeTerms.php
-
-
message: '#^Instantiated class Automattic\\WooCommerce\\Admin\\API\\WP_Error not found\.$#'
identifier: class.notFound
@@ -47175,12 +46701,6 @@ parameters:
count: 2
path: src/Admin/API/ProductAttributes.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/API/ProductAttributes.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\API\\ProductAttributes\:\:get_custom_attribute_by_slug\(\) should return object but returns array\.$#'
identifier: return.type
@@ -53235,12 +52755,6 @@ parameters:
count: 1
path: src/Admin/Features/Blueprint/RestApi.php
- -
- message: '#^Constant WC_ADMIN_APP not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Admin/Features/Features.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\Features\\Features\:\:add_admin_body_classes\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -53284,7 +52798,7 @@ parameters:
path: src/Admin/Features/Features.php
-
- message: '#^Parameter \#3 \$need_translation of static method Automattic\\WooCommerce\\Internal\\Admin\\WCAdminAssets\:\:register_script\(\) expects bool, array\<int, mixed\> given\.$#'
+ message: '#^Parameter \#3 \$need_translation of static method Automattic\\WooCommerce\\Internal\\Admin\\WCAdminAssets\:\:register_script\(\) expects bool, array\<int, string\> given\.$#'
identifier: argument.type
count: 1
path: src/Admin/Features/Features.php
@@ -53367,12 +52881,6 @@ parameters:
count: 1
path: src/Admin/Features/LaunchYourStore.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/Features/MarketingRecommendations/DefaultMarketingRecommendations.php
-
-
message: '#^Argument of an invalid type array\|null supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
@@ -54021,12 +53529,6 @@ parameters:
count: 1
path: src/Admin/Features/OnboardingTasks/Tasks/WooCommercePayments.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 48
- path: src/Admin/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\Features\\PaymentGatewaySuggestions\\DefaultPaymentGateways\:\:get_default_recommendation_priority\(\) should return int but returns null\.$#'
identifier: return.type
@@ -54213,12 +53715,6 @@ parameters:
count: 1
path: src/Admin/Features/ProductBlockEditor/BlockRegistry.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/Features/ProductBlockEditor/BlockRegistry.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\Features\\ProductBlockEditor\\BlockRegistry\:\:augment_attributes\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -54549,18 +54045,6 @@ parameters:
count: 1
path: src/Admin/Features/Settings/Init.php
- -
- message: '#^Constant WC_ADMIN_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Admin/Features/Settings/Init.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_JS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Admin/Features/Settings/Init.php
-
-
message: '#^Constant WPINC not found\.$#'
identifier: constant.notFound
@@ -54687,12 +54171,6 @@ parameters:
count: 1
path: src/Admin/Marketing/InstalledExtensions.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 16
- path: src/Admin/Marketing/InstalledExtensions.php
-
-
message: '#^Function Pinterest_For_Woocommerce not found\.$#'
identifier: function.notFound
@@ -55371,12 +54849,6 @@ parameters:
count: 1
path: src/Admin/PageController.php
- -
- message: '#^Constant WC_ADMIN_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/PageController.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\PageController\:\:connect_page\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -55923,12 +55395,6 @@ parameters:
count: 6
path: src/Admin/RemoteSpecs/DataSourcePoller.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/RemoteSpecs/DataSourcePoller.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\RemoteSpecs\\DataSourcePoller\:\:get_instance\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -56625,12 +56091,6 @@ parameters:
count: 1
path: src/Admin/RemoteSpecs/RuleProcessors/WCAdminActiveForRuleProcessor.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/ReportCSVEmail.php
-
-
message: '#^Method Automattic\\WooCommerce\\Admin\\ReportCSVEmail\:\:init_form_fields\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -56697,12 +56157,6 @@ parameters:
count: 1
path: src/Admin/ReportCSVExporter.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Admin/ReportCSVExporter.php
-
-
message: '#^Default value of the parameter \#1 \$type \(false\) of method Automattic\\WooCommerce\\Admin\\ReportCSVExporter\:\:__construct\(\) is incompatible with type string\.$#'
identifier: parameter.defaultValue
@@ -57267,12 +56721,6 @@ parameters:
count: 1
path: src/Blocks/AssetsController.php
- -
- message: '#^Constant WOOCOMMERCE_VERSION not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Blocks/BlockPatterns.php
-
-
message: '#^Method Automattic\\WooCommerce\\Blocks\\BlockPatterns\:\:load_pattern_content\(\) should return string but returns string\|false\.$#'
identifier: return.type
@@ -59589,12 +59037,6 @@ parameters:
count: 1
path: src/Blocks/BlockTypes/PaymentMethodIcons.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Blocks/BlockTypes/PaymentMethodIcons.php
-
-
message: '#^Method Automattic\\WooCommerce\\Blocks\\BlockTypes\\PaymentMethodIcons\:\:enqueue_data\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -61893,12 +61335,6 @@ parameters:
count: 1
path: src/Blocks/BlockTypesController.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Blocks/BlockTypesController.php
-
-
message: '#^Method Automattic\\WooCommerce\\Blocks\\BlockTypesController\:\:delete_product_transients\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -64701,12 +64137,6 @@ parameters:
count: 2
path: src/Internal/Admin/CustomerEffortScoreTracks.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Admin/CustomerEffortScoreTracks.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\CustomerEffortScoreTracks\:\:add_script_track_product_categories\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -65127,18 +64557,6 @@ parameters:
count: 2
path: src/Internal/Admin/FeaturePlugin.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/FeaturePlugin.php
-
- -
- message: '#^Constant WC_ADMIN_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 6
- path: src/Internal/Admin/FeaturePlugin.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\FeaturePlugin\:\:define\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -65182,32 +64600,56 @@ parameters:
path: src/Internal/Admin/FeaturePlugin.php
-
- message: '#^Unsafe usage of new static\(\)\.$#'
- identifier: new.static
+ message: '#^Path in require_once\(\) "/includes/react\-admin/class\-experimental\-abtest\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
count: 1
path: src/Internal/Admin/FeaturePlugin.php
-
- message: '#^Call to an undefined method WC_Data_Store\:\:get_zones\(\)\.$#'
- identifier: method.notFound
+ message: '#^Path in require_once\(\) "/includes/react\-admin/core\-functions\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
count: 1
- path: src/Internal/Admin/Homescreen.php
+ path: src/Internal/Admin/FeaturePlugin.php
-
- message: '#^Call to function method_exists\(\) with ''WC_Admin_Menus'' and ''can_view…'' will always evaluate to true\.$#'
- identifier: function.alreadyNarrowedType
+ message: '#^Path in require_once\(\) "/includes/react\-admin/feature\-config\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
count: 1
- path: src/Internal/Admin/Homescreen.php
+ path: src/Internal/Admin/FeaturePlugin.php
-
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
+ message: '#^Path in require_once\(\) "/includes/react\-admin/page\-controller\-functions\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
+ count: 1
+ path: src/Internal/Admin/FeaturePlugin.php
+
+ -
+ message: '#^Path in require_once\(\) "/includes/react\-admin/wc\-admin\-update\-functions\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
+ count: 1
+ path: src/Internal/Admin/FeaturePlugin.php
+
+ -
+ message: '#^Path in require_once\(\) "/src/Admin/Notes/DeprecatedNotes\.php" is not a file or it does not exist\.$#'
+ identifier: requireOnce.fileNotFound
+ count: 1
+ path: src/Internal/Admin/FeaturePlugin.php
+
+ -
+ message: '#^Unsafe usage of new static\(\)\.$#'
+ identifier: new.static
+ count: 1
+ path: src/Internal/Admin/FeaturePlugin.php
+
+ -
+ message: '#^Call to an undefined method WC_Data_Store\:\:get_zones\(\)\.$#'
+ identifier: method.notFound
count: 1
path: src/Internal/Admin/Homescreen.php
-
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
+ message: '#^Call to function method_exists\(\) with ''WC_Admin_Menus'' and ''can_view…'' will always evaluate to true\.$#'
+ identifier: function.alreadyNarrowedType
count: 1
path: src/Internal/Admin/Homescreen.php
@@ -65265,18 +64707,6 @@ parameters:
count: 1
path: src/Internal/Admin/Loader.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Loader.php
-
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Loader.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\Loader\:\:add_admin_body_classes\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -65925,12 +65355,6 @@ parameters:
count: 1
path: src/Internal/Admin/Notes/MarketingJetpack.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Notes/MarketingJetpack.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\Notes\\MarketingJetpack\:\:get_note\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -66609,12 +66033,6 @@ parameters:
count: 1
path: src/Internal/Admin/Onboarding/OnboardingProfile.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Onboarding/OnboardingSetupWizard.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\Onboarding\\OnboardingSetupWizard\:\:add_loading_classes\(\) should return array but returns bool\|string\.$#'
identifier: return.type
@@ -68235,18 +67653,6 @@ parameters:
count: 1
path: src/Internal/Admin/Settings.php
- -
- message: '#^Constant WC_ADMIN_IMAGES_FOLDER_URL not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Settings.php
-
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/Settings.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\Settings\:\:get_instance\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -69093,18 +68499,6 @@ parameters:
count: 1
path: src/Internal/Admin/SystemStatusReport.php
- -
- message: '#^Constant WC_ADMIN_APP not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Admin/Translations.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_JS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 4
- path: src/Internal/Admin/Translations.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\Translations\:\:build_and_save_translations\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -69165,42 +68559,6 @@ parameters:
count: 2
path: src/Internal/Admin/WCAdminAssets.php
- -
- message: '#^Constant WC_ADMIN_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 6
- path: src/Internal/Admin/WCAdminAssets.php
-
- -
- message: '#^Constant WC_ADMIN_APP not found\.$#'
- identifier: constant.notFound
- count: 11
- path: src/Internal/Admin/WCAdminAssets.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_CSS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Admin/WCAdminAssets.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_JS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 5
- path: src/Internal/Admin/WCAdminAssets.php
-
- -
- message: '#^Constant WC_ADMIN_PLUGIN_FILE not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Admin/WCAdminAssets.php
-
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Admin/WCAdminAssets.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Admin\\WCAdminAssets\:\:enqueue_assets\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -69279,6 +68637,12 @@ parameters:
count: 1
path: src/Internal/Admin/WCAdminAssets.php
+ -
+ message: '#^Parameter \#3 \$args of function wc_caught_exception expects array, string given\.$#'
+ identifier: argument.type
+ count: 1
+ path: src/Internal/Admin/WCAdminAssets.php
+
-
message: '#^Parameter \$dependency of method Automattic\\WooCommerce\\Internal\\Admin\\WCAdminAssets\:\:maybe_output_preload_link_tag\(\) has invalid type Automattic\\WooCommerce\\Internal\\Admin\\WP_Dependency\.$#'
identifier: class.notFound
@@ -69465,12 +68829,6 @@ parameters:
count: 1
path: src/Internal/BatchProcessing/BatchProcessingController.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 5
- path: src/Internal/Brands.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Brands\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -71886,18 +71244,6 @@ parameters:
count: 1
path: src/Internal/EmailEditor/Package.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/EmailEditor/PageRenderer.php
-
- -
- message: '#^Constant WC_ADMIN_DIST_JS_FOLDER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/EmailEditor/PageRenderer.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\EmailEditor\\PageRenderer\:\:render\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -72066,12 +71412,6 @@ parameters:
count: 1
path: src/Internal/Features/FeaturesController.php
- -
- message: '#^Constant WC_VERSION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Features/FeaturesController.php
-
-
message: '#^Filter callback return statement is missing\.$#'
identifier: return.missing
@@ -73002,18 +72342,6 @@ parameters:
count: 1
path: src/Internal/Logging/RemoteLogger.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Logging/RemoteLogger.php
-
- -
- message: '#^Constant WC_PLUGIN_BASENAME not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/Logging/RemoteLogger.php
-
-
message: '#^Constant WPINC not found\.$#'
identifier: constant.notFound
@@ -73068,12 +72396,6 @@ parameters:
count: 4
path: src/Internal/Logging/RemoteLogger.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Logging/SafeGlobalFunctionProxy.php
-
-
message: '#^Constant WPINC not found\.$#'
identifier: constant.notFound
@@ -75582,12 +74904,6 @@ parameters:
count: 1
path: src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\RestApi\\Routes\\V4\\Orders\\UpdateUtils\:\:init\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -76044,12 +75360,6 @@ parameters:
count: 1
path: src/Internal/RestApi/Routes/V4/Products/Controller.php
- -
- message: '#^Constant WC_DELIMITER not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/RestApi/Routes/V4/Products/Controller.php
-
-
message: '#^Instantiated class Automattic\\WooCommerce\\Internal\\RestApi\\Routes\\V4\\Products\\WC_Product_Attribute not found\.$#'
identifier: class.notFound
@@ -76722,12 +76032,6 @@ parameters:
count: 1
path: src/Internal/RestApi/Routes/V4/Refunds/Schema/RefundSchema.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\RestApi\\Routes\\V4\\Settings\\Account\\Controller\:\:get_item\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#'
identifier: missingType.generics
@@ -79038,12 +78342,6 @@ parameters:
count: 1
path: src/Internal/Utilities/PluginInstaller.php
- -
- message: '#^Constant WC_ABSPATH not found\.$#'
- identifier: constant.notFound
- count: 2
- path: src/Internal/Utilities/PluginInstaller.php
-
-
message: '#^Method Automattic\\WooCommerce\\Internal\\Utilities\\PluginInstaller\:\:handle_plugin_list_rows\(\) has no return type specified\.$#'
identifier: missingType.return
@@ -82836,12 +82134,6 @@ parameters:
count: 1
path: src/Utilities/ArrayUtil.php
- -
- message: '#^Constant WC_ROUNDING_PRECISION not found\.$#'
- identifier: constant.notFound
- count: 1
- path: src/Utilities/NumberUtil.php
-
-
message: '#^Parameter \#3 \$mode of function round expects 1\|2\|3\|4, int given\.$#'
identifier: argument.type
diff --git a/plugins/woocommerce/phpstan.neon b/plugins/woocommerce/phpstan.neon
index 4ef00c9b68..634a82c5ef 100644
--- a/plugins/woocommerce/phpstan.neon
+++ b/plugins/woocommerce/phpstan.neon
@@ -20,7 +20,14 @@ parameters:
- vendor/wordpress/abilities-api
scanFiles:
- php-stubs/wc-admin-feature-config.php
+ - php-stubs/wc-constants.php
treatPhpDocTypesAsCertain: false
+ dynamicConstantNames:
+ # WC_TAX_ROUNDING_MODE can be 1, 2 (ints) or 'auto' (string in tests).
+ # See tests/legacy/bootstrap.php and wc-core-functions.php:wc_get_tax_rounding_mode()
+ WC_TAX_ROUNDING_MODE: 1|2|'auto'
+ # WC_TEMPLATE_DEBUG_MODE can be overridden in wp-config.php
+ WC_TEMPLATE_DEBUG_MODE: bool
ignoreErrors:
- identifier: missingType.iterableValue
parallel:
diff --git a/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php b/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php
index 7e9d43411b..2a7ed72e43 100644
--- a/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php
+++ b/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php
@@ -112,6 +112,9 @@ class FeaturePlugin {
/**
* Define Constants.
+ *
+ * IMPORTANT: When adding new constants here, also add them to
+ * php-stubs/wc-constants.php for PHPStan static analysis.
*/
protected function define_constants() {
$this->define( 'WC_ADMIN_APP', 'wc-admin-app' );