瀏覽代碼

refactor(wechat): 更新参数类型声明以支持可空值

- 将 getUserID 方法中的 $appID 参数类型从 string 更新为 ?string
- 将 domesticRefunds 方法中的 $total 参数类型从 float 更新为 ?float
- 将 opSpecialOrder 方法中的 $delayTo 参数类型从 int 更新为 ?int
runphp 3 月之前
父節點
當前提交
0b89a764a5
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      src/Trait/ApiTrait.php
  2. 1 1
      src/Trait/MiniAppTrait.php

+ 1 - 1
src/Trait/ApiTrait.php

@@ -79,7 +79,7 @@ trait ApiTrait
      *
      * @param string $outRefundNo 商户退款单号
      */
-    private function domesticRefunds(string $outRefundNo, string $outTradeNo, float $refund, float $total = null, string $reason = '交易取消')
+    private function domesticRefunds(string $outRefundNo, string $outTradeNo, float $refund, ?float $total = null, string $reason = '交易取消')
     {
         $total = $total ?? $refund;
         // https://pay.weixin.qq.com/doc/v3/merchant/4012791862

+ 1 - 1
src/Trait/MiniAppTrait.php

@@ -16,7 +16,7 @@ trait MiniAppTrait
      * @param int $type 订单类型 1为预售商品订单,2为测试订单
      * @param int $delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略
      */
-    private function opSpecialOrder(string $orderID, int $type, int $delayTo = null): bool
+    private function opSpecialOrder(string $orderID, int $type, ?int $delayTo = null): bool
     {
         $response = WechatPayBuilder::getMiniApp()->getClient()->postJson('/wxa/sec/order/opspecialorder', [