Skip to content

Commit

Permalink
fix: Adapt to php8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
huanglonghui committed Apr 29, 2024
1 parent ac56c30 commit 65ee68c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/tests export-ignore
/docker-composer.yml export-ignore
/EXAMPLE.md export-ignore
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
}
},
"require": {
"easyswoole/spl": "^1.1",
"php": ">=8.1.0",
"easyswoole/spl": "^2.0",
"easyswoole/http-client": "^1.2",
"ext-bcmath": "*",
"ext-openssl":"*",
Expand Down
7 changes: 2 additions & 5 deletions src/AliPay/GateWay.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

namespace EasySwoole\Pay\AliPay;


use EasySwoole\Spl\SplEnum;

class GateWay extends SplEnum
class GateWay
{
const NORMAL = 'https://openapi.alipay.com/gateway.do';
const SANDBOX = 'https://openapi.alipaydev.com/gateway.do';
}
}
6 changes: 3 additions & 3 deletions src/AliPay/RequestBean/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public function setTimeoutExpress( $timeout_express ) : void
$this->timeout_express = $timeout_express;
}

public function toArray(array $columns = null, $filter = null): array
public function toArray(int|callable $filter = null): array
{
return parent::toArray(null, self::FILTER_NOT_NULL);
return parent::toArray($filter);
}

/**
Expand Down Expand Up @@ -137,4 +137,4 @@ public function setReturnUrl($returnUrl): void
{
$this->return_url = $returnUrl;
}
}
}
6 changes: 3 additions & 3 deletions src/AliPay/ResponseBean/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Base extends SplBean
protected $app_cert_sn;
protected $alipay_root_cert_sn;

public function toArray(array $columns = null, $filter = null): array
public function toArray(int|callable $filter = null): array
{
return parent::toArray(null, self::FILTER_NOT_NULL);
return parent::toArray($filter);
}
}
}
6 changes: 3 additions & 3 deletions src/WeChat/RequestBean/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function initialize(): void
* @param null $filter
* @return array
*/
public function toArray(array $columns = null, $filter = null): array
public function toArray(int|callable $filter = null): array
{
return parent::toArray(null, self::FILTER_NOT_NULL);
return parent::toArray($filter);
}

/**
Expand Down Expand Up @@ -214,4 +214,4 @@ public function setSubOpenid($sub_openid): void
{
$this->sub_openid = $sub_openid;
}
}
}
10 changes: 5 additions & 5 deletions src/WeChat/ResponseBean/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Base extends SplBean
// protected $refund_id;
// protected $refund_channel;

public function toArray(array $columns = null, $filter = null): array
{
return parent::toArray($columns, self::FILTER_NOT_NULL);
}
}
public function toArray(int|callable $filter = null): array
{
return parent::toArray($filter);
}
}
4 changes: 2 additions & 2 deletions tests/AliPayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ protected function buildPayHtml($endpoint, $payload)
{
$sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $endpoint . "' method='POST'>";
foreach ($payload as $key => $val) {
$val = str_replace("'", '&apos;', $val);
$val = str_replace("'", '&apos;', (string)$val);
$sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
}
$sHtml .= "<input type='submit' value='ok' style='display:none;'></form>";
Expand Down Expand Up @@ -426,4 +426,4 @@ protected function buildCertConfig()
$aliConfig->setMerchantCertPath(__DIR__ . '/cert/appCertPublicKey_2016091800538780.crt');
return $aliConfig;
}
}
}

0 comments on commit 65ee68c

Please sign in to comment.