From ca5e7a62aed465f93f33ce34f357ce59926f732a Mon Sep 17 00:00:00 2001 From: tikkhun Date: Wed, 5 Nov 2025 14:10:48 +0800 Subject: [PATCH] =?UTF-8?q?docs(ide):=20=E6=B7=BB=E5=8A=A0=20WooCommerce?= =?UTF-8?q?=20Blocks=20=E7=9A=84=20IDE=20=E5=AD=98=E6=A0=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=94=A8=E4=BA=8E=E9=9D=99=E6=80=81=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 IDE 存根文件以消除静态分析工具中的“未定义类型”警告 该文件仅用于 IDE 和代码检查,不应在运行时加载 --- .../blocks/class-yoone-blocks-moneris.php | 5 ++- includes/blocks/ide-stub-wc-blocks.php | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 includes/blocks/ide-stub-wc-blocks.php diff --git a/includes/blocks/class-yoone-blocks-moneris.php b/includes/blocks/class-yoone-blocks-moneris.php index 0c0bd18..66c0c9b 100644 --- a/includes/blocks/class-yoone-blocks-moneris.php +++ b/includes/blocks/class-yoone-blocks-moneris.php @@ -42,7 +42,10 @@ function yoone_moneris_store_payment_data($order, $result, $request) { // Only declare the Blocks payment method class when the Blocks base type exists to prevent type resolution issues. if (class_exists('Automattic\WooCommerce\Blocks\Payments\PaymentMethodType') && ! class_exists('Yoone_Moneris_Blocks_Payment_Method')) { - class Yoone_Moneris_Blocks_Payment_Method extends Automattic\WooCommerce\Blocks\Payments\PaymentMethodType { + /** + * 使用 use 导入基类,避免 IDE 报 Undefined type + */ +class Yoone_Moneris_Blocks_Payment_Method extends Automattic\WooCommerce\Blocks\Payments\PaymentMethodType { /** * Unique name of the payment method in Blocks. * This MUST match the gateway id used by WooCommerce (yoone_moneris). diff --git a/includes/blocks/ide-stub-wc-blocks.php b/includes/blocks/ide-stub-wc-blocks.php new file mode 100644 index 0000000..6dcd559 --- /dev/null +++ b/includes/blocks/ide-stub-wc-blocks.php @@ -0,0 +1,34 @@ +