From f02ef42cb794a481d75b9578ce1eb5f30d10edac Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Mon, 1 Dec 2025 18:17:32 +0300 Subject: [PATCH] refactor: use phpstan stubs instead of opencart sources --- .../upload/oc_telegram_shop/phpstan.neon | 6 +-- .../src/Services/CartService.php | 2 +- .../upload/oc_telegram_shop/stubs/Cart.php | 7 ++++ .../upload/oc_telegram_shop/stubs/Proxy.php | 5 +++ .../oc_telegram_shop/stubs/Registry.php | 5 +++ .../upload/oc_telegram_shop/stubs/Tax.php | 7 ++++ .../upload/oc_telegram_shop/stubs/config.php | 28 ++++++++++++++ .../oc_telegram_shop/stubs/currency.php | 38 +++++++++++++++++++ 8 files changed, 92 insertions(+), 6 deletions(-) create mode 100755 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Cart.php create mode 100755 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Proxy.php create mode 100755 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Registry.php create mode 100755 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Tax.php create mode 100644 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/config.php create mode 100644 module/oc_telegram_shop/upload/oc_telegram_shop/stubs/currency.php diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/phpstan.neon b/module/oc_telegram_shop/upload/oc_telegram_shop/phpstan.neon index 1da1883..220bbb3 100644 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/phpstan.neon +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/phpstan.neon @@ -6,10 +6,6 @@ parameters: - framework scanDirectories: - - /web/upload/system - - scanFiles: - - /web/upload/config.php - - /web/upload/admin/config.php + - stubs inferPrivatePropertyTypeFromConstructor: true \ No newline at end of file diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/CartService.php b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/CartService.php index a6139d3..cf5e4af 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/CartService.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/CartService.php @@ -119,7 +119,7 @@ class CartService 'product_option_id' => (int) $option['product_option_id'], 'product_option_value_id' => (int) $option['product_option_value_id'], 'name' => $option['name'], - 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value), + 'value' => (strlen($value) > 20 ? substr($value, 0, 20) . '..' : $value), 'type' => $option['type'], ]; } diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Cart.php b/module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Cart.php new file mode 100755 index 0000000..0a061fa --- /dev/null +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/stubs/Cart.php @@ -0,0 +1,7 @@ +