diff --git a/base/Subject.php b/base/Subject.php index 01dce8b..3f2bf2e 100644 --- a/base/Subject.php +++ b/base/Subject.php @@ -27,7 +27,7 @@ abstract class Subject extends Multiprogramming /** * @param array $keywords */ - public function setKeywords(array $keywords) + public function setKeywords(array $keywords): void { $this->keywords = $keywords; } @@ -35,7 +35,7 @@ abstract class Subject extends Multiprogramming /** * @param $templateId */ - public function setTemplateId($templateId) + public function setTemplateId($templateId): void { $this->templateId = $templateId; } @@ -43,7 +43,7 @@ abstract class Subject extends Multiprogramming /** * @param $openId */ - public function setOpenId($openId) + public function setOpenId($openId): void { $this->openId = $openId; } @@ -51,7 +51,7 @@ abstract class Subject extends Multiprogramming /** * @param $page */ - public function setPage($page) + public function setPage($page): void { $this->page = $page; } @@ -59,7 +59,7 @@ abstract class Subject extends Multiprogramming /** * @param $emphasis_keyword */ - public function setEmphasisKeyword($emphasis_keyword) + public function setEmphasisKeyword($emphasis_keyword): void { $this->emphasis_keyword = $emphasis_keyword; } @@ -69,7 +69,7 @@ abstract class Subject extends Multiprogramming * @param $context * @param string $color */ - public function replaceKeyword($index, $context, string $color = '') + public function replaceKeyword($index, $context, string $color = ''): void { if (empty($color)) { $color = '#000'; @@ -85,7 +85,7 @@ abstract class Subject extends Multiprogramming * @param $color * @param $context */ - public function addKeyword($context, $color = null) + public function addKeyword($context, $color = null): void { if (empty($color)) { $color = '#000'; @@ -135,7 +135,7 @@ abstract class Subject extends Multiprogramming /** * @return Result - * @throws \Exception + * @throws */ public function sendTemplate(): Result { @@ -158,7 +158,7 @@ abstract class Subject extends Multiprogramming if (!empty($this->use_robot)) { $params['use_robot'] = $this->use_robot; } - $this->reset($result); + $this->reset(); $client = new Client($this->getHost(), 443, true); $client->withHeader(['Content-Type' => 'application/json; charset=utf-8']); @@ -184,17 +184,14 @@ abstract class Subject extends Multiprogramming } /** - * @param $result - * @return mixed + * @return void */ - public function reset($result) + public function reset(): void { $this->openId = ''; $this->keywords = []; $this->templateId = ''; $this->page = ''; - - return $result; } } diff --git a/base/Template.php b/base/Template.php index 3cf4782..0d895e7 100644 --- a/base/Template.php +++ b/base/Template.php @@ -13,126 +13,126 @@ abstract class Template extends Multiprogramming { - private array $keywords = []; - private string $templateId = ''; - private string $formId = ''; - private string $openId = ''; - private string $page = 'pages/index/index'; - private string $emphasis_keyword = ''; + private array $keywords = []; + private string $templateId = ''; + private string $formId = ''; + private string $openId = ''; + private string $page = 'pages/index/index'; + private string $emphasis_keyword = ''; - /** - * @param array $keywords - */ - public function setKeywords(array $keywords) - { - $this->keywords = $keywords; - } + /** + * @param array $keywords + */ + public function setKeywords(array $keywords): void + { + $this->keywords = $keywords; + } - /** - * @param $templateId - */ - public function setTemplateId($templateId) - { - $this->templateId = $templateId; - } + /** + * @param $templateId + */ + public function setTemplateId($templateId): void + { + $this->templateId = $templateId; + } - /** - * @param $formId - */ - public function setFormId($formId) - { - $this->formId = $formId; - } + /** + * @param $formId + */ + public function setFormId($formId): void + { + $this->formId = $formId; + } - /** - * @param $openId - */ - public function setOpenId($openId) - { - $this->openId = $openId; - } + /** + * @param $openId + */ + public function setOpenId($openId): void + { + $this->openId = $openId; + } - /** - * @param $page - */ - public function setPage($page) - { - $this->page = $page; - } + /** + * @param $page + */ + public function setPage($page): void + { + $this->page = $page; + } - /** - * @param $emphasis_keyword - */ - public function setEmphasisKeyword($emphasis_keyword) - { - $this->emphasis_keyword = $emphasis_keyword; - } + /** + * @param $emphasis_keyword + */ + public function setEmphasisKeyword($emphasis_keyword): void + { + $this->emphasis_keyword = $emphasis_keyword; + } /** * @param $index * @param $context * @param string $color */ - public function replaceKeyword($index, $context, string $color = '') - { - if (empty($color)) { - $color = '#000'; - } - $this->keywords['keyword' . $index] = [ - 'value' => $context, - 'color' => $color - ]; - } + public function replaceKeyword($index, $context, string $color = ''): void + { + if (empty($color)) { + $color = '#000'; + } + $this->keywords['keyword' . $index] = [ + 'value' => $context, + 'color' => $color + ]; + } - /** - * @param $color - * @param $context - */ - public function addKeyword($context, $color = null) - { - if (empty($color)) { - $color = '#000'; - } - $this->keywords['keyword' . (count($this->keywords) + 1)] = [ - 'value' => $context, - 'color' => $color - ]; - } + /** + * @param $color + * @param $context + */ + public function addKeyword($context, $color = null): void + { + if (empty($color)) { + $color = '#000'; + } + $this->keywords['keyword' . (count($this->keywords) + 1)] = [ + 'value' => $context, + 'color' => $color + ]; + } - abstract public function getUrl(); + abstract public function getUrl(); - abstract public function getHost(); + abstract public function getHost(); - /** - * @return Result - * @throws \Exception - * - * 奴隶交易通知 - */ - public function sendTemplate(): Result - { - $access_token = $this->payConfig->getAccessToken(); - if (empty($access_token)) { - throw new \Exception('request access_token con\'t null.'); - } + /** + * @return Result + * @throws + * + * 奴隶交易通知 + */ + public function sendTemplate(): Result + { + $access_token = $this->payConfig->getAccessToken(); + if (empty($access_token)) { + throw new \Exception('request access_token con\'t null.'); + } - $params = [ - "touser" => $this->openId, - "template_id" => $this->templateId, - "page" => $this->page, - "form_id" => $this->formId, - "data" => $this->keywords, - ]; + $params = [ + "touser" => $this->openId, + "template_id" => $this->templateId, + "page" => $this->page, + "form_id" => $this->formId, + "data" => $this->keywords, + ]; - if (!empty($this->emphasis_keyword)) { - $params['emphasis_keyword'] = $this->emphasis_keyword; - } + if (!empty($this->emphasis_keyword)) { + $params['emphasis_keyword'] = $this->emphasis_keyword; + } - $this->reset($result); + $this->reset(); - $client = new Client($this->getHost(), 443, true); - $client->withHeader(['Content-Type' => 'application/json; charset=utf-8']); + $client = new Client($this->getHost(), 443, true); + $client->withHeader(['Content-Type' => 'application/json; charset=utf-8']); $proxyHost = $this->payConfig->getProxyHost(); $proxyPort = $this->payConfig->getProxyPort(); @@ -141,29 +141,28 @@ abstract class Template extends Multiprogramming } $client->post($this->getUrl() . '?access_token=' . $access_token, $params); - $client->close(); + $client->close(); - if (!in_array($client->getStatusCode(), [101, 200, 201])) { - return new Result(code: 505, message: $client->getBody()); - } - $body = json_decode($client->getBody(), true); - if (isset($body['errcode']) && $body['errcode'] != 0) { - return new Result(code: $body['errcode'], message: $body['errmsg']); - } - return new Result(code: 0, data: $body); - } + if (!in_array($client->getStatusCode(), [101, 200, 201])) { + return new Result(code: 505, message: $client->getBody()); + } + $body = json_decode($client->getBody(), true); + if (isset($body['errcode']) && $body['errcode'] != 0) { + return new Result(code: $body['errcode'], message: $body['errmsg']); + } + return new Result(code: 0, data: $body); + } - /** - * @param $result - * @return void - */ - private function reset($result): void - { - $this->openId = ''; - $this->keywords = []; - $this->formId = ''; - $this->templateId = ''; - $this->page = ''; - } + /** + * @return void + */ + private function reset(): void + { + $this->openId = ''; + $this->keywords = []; + $this->formId = ''; + $this->templateId = ''; + $this->page = ''; + } } diff --git a/common/AppConfig.php b/common/AppConfig.php index a1edb1f..5b3827c 100644 --- a/common/AppConfig.php +++ b/common/AppConfig.php @@ -11,10 +11,10 @@ class AppConfig { - const TYPE_WCHAT_PROJECT = 0; - const TYPE_ALI_GAME_OR_APPLET = 3; - const TYPE_QQ_GAME_OR_APPLET = 1; - const TYPE_APP_PROJECT = 2; + const int TYPE_WCHAT_PROJECT = 0; + const int TYPE_ALI_GAME_OR_APPLET = 3; + const int TYPE_QQ_GAME_OR_APPLET = 1; + const int TYPE_APP_PROJECT = 2; /** diff --git a/common/Multiprogramming.php b/common/Multiprogramming.php index 9bae597..8722fe1 100644 --- a/common/Multiprogramming.php +++ b/common/Multiprogramming.php @@ -37,7 +37,7 @@ abstract class Multiprogramming implements Progaram /** * @param $code */ - public function setErrorCode($code) + public function setErrorCode($code): void { $this->errorCode = $code; } @@ -45,7 +45,7 @@ abstract class Multiprogramming implements Progaram /** * @param $message */ - public function setErrorMessage($message) + public function setErrorMessage($message): void { $this->errorMsg = $message; } diff --git a/common/Result.php b/common/Result.php index e79a28b..0caa81f 100644 --- a/common/Result.php +++ b/common/Result.php @@ -107,7 +107,7 @@ class Result * @param $key * @param $data * @return $this - * @throws Exception + * @throws */ public function setAttr($key, $data): static { diff --git a/qq/Account.php b/qq/Account.php index 7dfff53..de1d6f6 100644 --- a/qq/Account.php +++ b/qq/Account.php @@ -8,7 +8,6 @@ namespace wchat\qq; -use Kiri\Client; use wchat\common\Result; class Account extends SmallProgram diff --git a/qq/Notify.php b/qq/Notify.php index 2a62e67..e4c99c2 100644 --- a/qq/Notify.php +++ b/qq/Notify.php @@ -12,83 +12,83 @@ use wchat\common\Help; */ class Notify extends SmallProgram { - public mixed $appid = null; - public mixed $mch_id = null; - public mixed $nonce_str = null; - public mixed $sign = null; - public mixed $device_info = null; - public mixed $trade_type = null; - public mixed $trade_state = null; - public mixed $bank_type = null; - public mixed $fee_type = null; - public mixed $total_fee = null; - public mixed $cash_fee = null; - public mixed $coupon_fee = null; - public mixed $transaction_id = null; - public mixed $out_trade_no = null; - public mixed $attach = null; - public mixed $time_end = null; - public mixed $openid = null; + public mixed $appid = null; + public mixed $mch_id = null; + public mixed $nonce_str = null; + public mixed $sign = null; + public mixed $device_info = null; + public mixed $trade_type = null; + public mixed $trade_state = null; + public mixed $bank_type = null; + public mixed $fee_type = null; + public mixed $total_fee = null; + public mixed $cash_fee = null; + public mixed $coupon_fee = null; + public mixed $transaction_id = null; + public mixed $out_trade_no = null; + public mixed $attach = null; + public mixed $time_end = null; + public mixed $openid = null; - /** - * @return bool - * 判断是否完成支付 - */ - public function isSuccess(): bool - { - return $this->trade_state === 'SUCCESS'; - } + /** + * @return bool + * 判断是否完成支付 + */ + public function isSuccess(): bool + { + return $this->trade_state === 'SUCCESS'; + } - /** - * @param array $params - * @return $this - * @throws Exception - */ - public function setPayNotifyData(array $params): static - { - if (!$this->validation($params)) { - throw new Exception('签名错误!'); - } - foreach ($params as $key => $val) { - $this->$key = $val; - } - return $this; - } + /** + * @param array $params + * @return $this + * @throws + */ + public function setPayNotifyData(array $params): static + { + if (!$this->validation($params)) { + throw new Exception('签名错误!'); + } + foreach ($params as $key => $val) { + $this->$key = $val; + } + return $this; + } - public function __set(string $name, $value): void - { - if (property_exists($this, $name)) { - $this->{$name} = $value; - } - } + public function __set(string $name, $value): void + { + if (property_exists($this, $name)) { + $this->{$name} = $value; + } + } - /** - * @param array $params - * @return bool - */ - public function validation(array $params): bool - { - $sign = $params['sign']; - unset($params['sign']); + /** + * @param array $params + * @return bool + */ + public function validation(array $params): bool + { + $sign = $params['sign']; + unset($params['sign']); - $signType = $this->payConfig->getSignType(); - $privateKey = $this->payConfig->pay->qq->mchSecret; - $nowSign = Help::sign($params, $privateKey, $signType); - if ($sign === $nowSign) { - return true; - } - return false; - } + $signType = $this->payConfig->getSignType(); + $privateKey = $this->payConfig->pay->qq->mchSecret; + $nowSign = Help::sign($params, $privateKey, $signType); + if ($sign === $nowSign) { + return true; + } + return false; + } - /** - * @return null - */ - public function getAppid() - { - return $this->appid; - } + /** + * @return null + */ + public function getAppid(): mixed + { + return $this->appid; + } } diff --git a/qq/QqFactory.php b/qq/QqFactory.php index 741f949..4fcc4ea 100644 --- a/qq/QqFactory.php +++ b/qq/QqFactory.php @@ -3,7 +3,6 @@ namespace wchat\wx; use Kiri\Di\Container; -use ReflectionException; use wchat\common\AppConfig; class QqFactory @@ -14,15 +13,15 @@ class QqFactory * @param $class * @param AppConfig $config * @return mixed - * @throws ReflectionException + * @throws */ - public static function get($class, AppConfig $config): mixed - { - $container = Container::instance(); - $object = $container->get($class); - $object->setPayConfig($config); - return $object; - } + public static function get($class, AppConfig $config): mixed + { + $container = Container::instance(); + $object = $container->get($class); + $object->setPayConfig($config); + return $object; + } } diff --git a/qq/Recharge.php b/qq/Recharge.php index 3c997c4..f9afcbe 100644 --- a/qq/Recharge.php +++ b/qq/Recharge.php @@ -8,8 +8,6 @@ namespace wchat\qq; -use Exception; -use Kiri\Client; use wchat\common\Result; use wchat\common\Help; @@ -30,7 +28,7 @@ class Recharge extends SmallProgram /** * @param string $value */ - public function setSpillCreateIp(string $value) + public function setSpillCreateIp(string $value): void { $this->spill_create_ip = $value; } diff --git a/qq/SecCheck.php b/qq/SecCheck.php index 55d9822..31c245b 100644 --- a/qq/SecCheck.php +++ b/qq/SecCheck.php @@ -4,7 +4,6 @@ namespace wchat\qq; -use Kiri\Client; use wchat\common\Result; /** diff --git a/qq/Subject.php b/qq/Subject.php index d527b25..191633c 100644 --- a/qq/Subject.php +++ b/qq/Subject.php @@ -4,7 +4,6 @@ namespace wchat\qq; -use wchat\common\Result; /** * Class Subject diff --git a/qq/Token.php b/qq/Token.php index 97aed79..a108aee 100644 --- a/qq/Token.php +++ b/qq/Token.php @@ -4,7 +4,6 @@ namespace wchat\qq; -use Kiri\Client; use wchat\common\Result; class Token extends SmallProgram diff --git a/qq/pay/Cash_Bonus.php b/qq/pay/Cash_Bonus.php index 0ae33e8..9aa010d 100644 --- a/qq/pay/Cash_Bonus.php +++ b/qq/pay/Cash_Bonus.php @@ -37,7 +37,7 @@ class Cash_Bonus extends SmallProgram /** * @param string $value */ - public function setMchName(string $value) + public function setMchName(string $value): void { $this->_requestParams['mch_name'] = $value; } @@ -45,7 +45,7 @@ class Cash_Bonus extends SmallProgram /** * @param string $value */ - public function setActName(string $value) + public function setActName(string $value): void { $this->_requestParams['act_name'] = $value; } @@ -53,7 +53,7 @@ class Cash_Bonus extends SmallProgram /** * @param string $value */ - public function setWishing(string $value) + public function setWishing(string $value): void { $this->_requestParams['wishing'] = $value; } @@ -61,7 +61,7 @@ class Cash_Bonus extends SmallProgram /** * @param int $value */ - public function setIconId(int $value) + public function setIconId(int $value): void { $this->_requestParams['icon_id'] = $value; } @@ -69,7 +69,7 @@ class Cash_Bonus extends SmallProgram /** * @param int $value */ - public function setBannerId(int $value) + public function setBannerId(int $value): void { $this->_requestParams['banner_id'] = $value; } diff --git a/qq/pay/Enterprise_payment.php b/qq/pay/Enterprise_payment.php index eb8c30d..d687f0c 100644 --- a/qq/pay/Enterprise_payment.php +++ b/qq/pay/Enterprise_payment.php @@ -40,7 +40,7 @@ class Enterprise_payment extends SmallProgram /** * @param string $value */ - public function setOpUserId(string $value) + public function setOpUserId(string $value): void { $this->_requestParams['op_user_id'] = $value; } @@ -48,7 +48,7 @@ class Enterprise_payment extends SmallProgram /** * @param string $value */ - public function setOpUserPassword(string $value) + public function setOpUserPassword(string $value): void { $this->_requestParams['op_user_passwd'] = $value; } @@ -56,7 +56,7 @@ class Enterprise_payment extends SmallProgram /** * @param string $value */ - public function setSpbillCreateIp(string $value) + public function setSpbillCreateIp(string $value): void { $this->_requestParams['spbill_create_ip'] = $value; } diff --git a/qq/result/RedHatResult.php b/qq/result/RedHatResult.php index 5c4d8ec..98445eb 100644 --- a/qq/result/RedHatResult.php +++ b/qq/result/RedHatResult.php @@ -23,10 +23,10 @@ class RedHatResult public mixed $uin; - const RED_HAT_STATUS_PAID = 1; - const RED_HAT_STATUS_SNATCHED = 2; - const RED_HAT_STATUS_EXPIRED = 3; - const RED_HAT_STATUS_REFUNDED = 4; + const int RED_HAT_STATUS_PAID = 1; + const int RED_HAT_STATUS_SNATCHED = 2; + const int RED_HAT_STATUS_EXPIRED = 3; + const int RED_HAT_STATUS_REFUNDED = 4; /** diff --git a/wx/Account.php b/wx/Account.php index 7ff48d1..7a1d7ab 100644 --- a/wx/Account.php +++ b/wx/Account.php @@ -8,7 +8,6 @@ namespace wchat\wx; -use Exception; use wchat\common\Result; class Account extends SmallProgram diff --git a/wx/Message.php b/wx/Message.php index 40e09eb..c80a0f7 100644 --- a/wx/Message.php +++ b/wx/Message.php @@ -4,7 +4,6 @@ namespace wchat\wx; use Exception; -use Kiri\Client; use wchat\common\Result; @@ -21,7 +20,7 @@ class Message extends SmallProgram /** * @param string $openid */ - public function setOpenid(string $openid) + public function setOpenid(string $openid): void { $this->msgData['touser'] = $openid; } @@ -29,7 +28,7 @@ class Message extends SmallProgram /** * @param string $content * @return Result - * @throws Exception + * @throws */ public function sendTextNews(string $content): Result { @@ -42,7 +41,7 @@ class Message extends SmallProgram /** * @param string $media_id * @return Result - * @throws Exception + * @throws */ public function sendImageNews(string $media_id): Result { @@ -56,7 +55,7 @@ class Message extends SmallProgram /** * @param string $media_id * @return Result - * @throws Exception + * @throws */ public function sendVoiceNews(string $media_id): Result { @@ -69,7 +68,7 @@ class Message extends SmallProgram /** * @param string $media_id * @return Result - * @throws Exception + * @throws */ public function sendMpNewsNews(string $media_id): Result { @@ -86,7 +85,7 @@ class Message extends SmallProgram * @param string $url * @param string $picurl * @return Result - * @throws Exception + * @throws */ public function sendNewsNews(string $title, string $description, string $url, string $picurl): Result { @@ -108,7 +107,7 @@ class Message extends SmallProgram /** * @param string $title * @return Result - * @throws Exception + * @throws */ public function sendCardNews(string $title): Result { @@ -125,7 +124,7 @@ class Message extends SmallProgram * @param string $title * @param string $description * @return Result - * @throws Exception + * @throws */ public function sendVideoNews(string $media_id, string $thumb_media_id, string $title, string $description): Result { @@ -149,7 +148,7 @@ class Message extends SmallProgram * @param string $title * @param string $description * @return Result - * @throws Exception + * @throws */ public function sendMusicNews(string $musicurl, string $hqmusicurl, string $thumb_media_id, string $title, string $description): Result { @@ -170,7 +169,7 @@ class Message extends SmallProgram * @param string $tail_content * @param array $menus * @return Result - * @throws Exception + * @throws */ public function sendMenuNews(string $head_content, string $tail_content, array $menus = []): Result { @@ -210,7 +209,7 @@ class Message extends SmallProgram * @param string $pagepath * @param string $thumb_media_id * @return Result - * @throws Exception + * @throws */ public function sendMiniprogrampageNews(string $title, string $appid, string $pagepath, string $thumb_media_id): Result { @@ -231,7 +230,7 @@ class Message extends SmallProgram * @param string $title * @param string $introduction * @return mixed - * @throws Exception + * @throws */ public function uploadFile(string $filePath, string $type, bool $isPermanent = false, string $title = '', string $introduction = ''): Result { @@ -268,7 +267,7 @@ class Message extends SmallProgram /** * @return Result - * @throws Exception + * @throws */ private function sendKefuMsg(): Result { diff --git a/wx/Notify.php b/wx/Notify.php index 3455492..a5c4ac0 100644 --- a/wx/Notify.php +++ b/wx/Notify.php @@ -71,11 +71,11 @@ class Notify extends SmallProgram } - /** - * @param string $name - * @param $value - * @return void - */ + /** + * @param string $name + * @param mixed $value + * @return void + */ public function __set(string $name, mixed $value): void { if (property_exists($this, $name)) { diff --git a/wx/PublicTemplate.php b/wx/PublicTemplate.php index dbfc584..bc9aeff 100644 --- a/wx/PublicTemplate.php +++ b/wx/PublicTemplate.php @@ -8,7 +8,6 @@ namespace wchat\wx; -use Kiri\Client; use wchat\common\Result; class PublicTemplate extends SmallProgram @@ -27,7 +26,7 @@ class PublicTemplate extends SmallProgram /** * @param array $keywords */ - public function setKeywords(array $keywords) + public function setKeywords(array $keywords): void { $this->keywords = $keywords; } @@ -35,7 +34,7 @@ class PublicTemplate extends SmallProgram /** * @param string $templateId */ - public function setTemplateId(string $templateId) + public function setTemplateId(string $templateId): void { $this->templateId = $templateId; } @@ -43,7 +42,7 @@ class PublicTemplate extends SmallProgram /** * @param string $openId */ - public function setOpenId(string $openId) + public function setOpenId(string $openId): void { $this->openId = $openId; } @@ -51,7 +50,7 @@ class PublicTemplate extends SmallProgram /** * @param string $defaultUrl */ - public function setDefaultUrl(string $defaultUrl) + public function setDefaultUrl(string $defaultUrl): void { $this->defaultUrl = $defaultUrl; } @@ -61,7 +60,7 @@ class PublicTemplate extends SmallProgram * @param string $context * @param string $color */ - public function replaceKeyword(string $name, string $context, string $color = '') + public function replaceKeyword(string $name, string $context, string $color = ''): void { $this->keywords[$name] = ['value' => $context, 'color' => $color]; } @@ -72,7 +71,7 @@ class PublicTemplate extends SmallProgram * @param string $context * @param null $color */ - public function addKeyword(string $name, string $context, $color = null) + public function addKeyword(string $name, string $context, $color = null): void { if (empty($color)) { $color = '#000'; @@ -124,7 +123,7 @@ class PublicTemplate extends SmallProgram /** * @return Result - * @throws \Exception + * @throws * * 奴隶交易通知 */ diff --git a/wx/SecCheck.php b/wx/SecCheck.php index b3d1549..b9ac6fe 100644 --- a/wx/SecCheck.php +++ b/wx/SecCheck.php @@ -4,7 +4,6 @@ namespace wchat\wx; -use Kiri\Client; use wchat\common\Result; /** @@ -17,8 +16,8 @@ class SecCheck extends SmallProgram private string $_url = '/wxa/img_sec_check?access_token='; private string $_msgUrl = '/wxa/msg_sec_check?access_token='; private string $_mediaCheckAsync = '/wxa/media_check_async?access_token='; - const MEDIA_VIDEO = 1; - const MEDIA_IMAGE = 1; + const int MEDIA_VIDEO = 1; + const int MEDIA_IMAGE = 1; /** * @param string $path diff --git a/wx/Subject.php b/wx/Subject.php index 3f48a56..de53b10 100644 --- a/wx/Subject.php +++ b/wx/Subject.php @@ -4,7 +4,6 @@ namespace wchat\wx; -use wchat\common\Result; /** * Class Subject diff --git a/wx/Token.php b/wx/Token.php index 5e5982c..b4ff16d 100644 --- a/wx/Token.php +++ b/wx/Token.php @@ -4,7 +4,6 @@ namespace wchat\wx; -use Kiri\Client; use wchat\common\Result; class Token extends SmallProgram diff --git a/wx/V3/Notify/NotifyModel.php b/wx/V3/Notify/NotifyModel.php index f78f938..3dbc6fd 100644 --- a/wx/V3/Notify/NotifyModel.php +++ b/wx/V3/Notify/NotifyModel.php @@ -8,44 +8,44 @@ class NotifyModel { //公众号支付 - const PAY_TYPE_JSAPI = 'JSAPI'; + const string PAY_TYPE_JSAPI = 'JSAPI'; //扫码支付 - const PAY_TYPE_NATIVE = 'NATIVE'; + const string PAY_TYPE_NATIVE = 'NATIVE'; //App支付 - const PAY_TYPE_App = 'App'; + const string PAY_TYPE_App = 'App'; //付款码支付 - const PAY_TYPE_MICROPAY = 'MICROPAY'; + const string PAY_TYPE_MICROPAY = 'MICROPAY'; //H5支付 - const PAY_TYPE_MWEB = 'MWEB'; + const string PAY_TYPE_MWEB = 'MWEB'; //刷脸支付 - const PAY_TYPE_FACEPAY = 'FACEPAY'; + const string PAY_TYPE_FACEPAY = 'FACEPAY'; // 支付成功 - const PAY_RESULT_SUCCESS = 'SUCCESS'; + const string PAY_RESULT_SUCCESS = 'SUCCESS'; // 转入退款 - const PAY_RESULT_REFUND = 'REFUND'; + const string PAY_RESULT_REFUND = 'REFUND'; // 未支付 - const PAY_RESULT_NOTPAY = 'NOTPAY'; + const string PAY_RESULT_NOTPAY = 'NOTPAY'; // 已关闭 - const PAY_RESULT_CLOSED = 'CLOSED'; + const string PAY_RESULT_CLOSED = 'CLOSED'; // 已撤销(付款码支付) - const PAY_RESULT_REVOKED = 'REVOKED'; + const string PAY_RESULT_REVOKED = 'REVOKED'; // 用户支付中(付款码支付) - const PAY_RESULT_USERPAYING = 'USERPAYING'; + const string PAY_RESULT_USERPAYING = 'USERPAYING'; // 支付失败(其他原因,如银行返回失败) - const PAY_RESULT_PAYERROR = 'PAYERROR'; + const string PAY_RESULT_PAYERROR = 'PAYERROR'; public string $appid; diff --git a/wx/V3/TransferBatches.php b/wx/V3/TransferBatches.php index e9bf744..ce7ae45 100644 --- a/wx/V3/TransferBatches.php +++ b/wx/V3/TransferBatches.php @@ -2,10 +2,7 @@ namespace wchat\wx\V3; -use Exception; use JetBrains\PhpStorm\ArrayShape; -use Kiri\Client; -use Kiri\CurlClient; use wchat\wx\SmallProgram; class TransferBatches extends SmallProgram @@ -16,7 +13,7 @@ class TransferBatches extends SmallProgram /** * @param TransferDetail $detail * @return array - * @throws Exception + * @throws */ #[ArrayShape([])] public function transfer(TransferDetail $detail): array diff --git a/wx/V3/TransferDetail.php b/wx/V3/TransferDetail.php index fec5bb0..765e5d6 100644 --- a/wx/V3/TransferDetail.php +++ b/wx/V3/TransferDetail.php @@ -16,11 +16,11 @@ class TransferDetail * @param string $user_name */ public function __construct( - readonly public string $out_detail_no, - readonly public int|float $transfer_amount, - readonly public string $transfer_remark, - readonly public string $openid, - readonly public string $user_name = '' + public string $out_detail_no, + public int|float $transfer_amount, + public string $transfer_remark, + public string $openid, + public string $user_name = '' ) { } diff --git a/wx/V3/WxV3AppPayment.php b/wx/V3/WxV3AppPayment.php index 26cb385..5f1f016 100644 --- a/wx/V3/WxV3AppPayment.php +++ b/wx/V3/WxV3AppPayment.php @@ -3,7 +3,6 @@ namespace wchat\wx\V3; use Exception; -use Kiri\Client; use wchat\wx\SmallProgram; class WxV3AppPayment extends SmallProgram @@ -19,7 +18,7 @@ class WxV3AppPayment extends SmallProgram * @param string|null $openId * @param string $payer_client_ip * @return array - * @throws Exception + * @throws */ public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array { diff --git a/wx/V3/WxV3NativePayment.php b/wx/V3/WxV3NativePayment.php index 4bc5e49..9e02e00 100644 --- a/wx/V3/WxV3NativePayment.php +++ b/wx/V3/WxV3NativePayment.php @@ -3,7 +3,6 @@ namespace wchat\wx\V3; use Exception; -use Kiri\Client; use JetBrains\PhpStorm\ArrayShape; use wchat\wx\SmallProgram; @@ -20,7 +19,7 @@ class WxV3NativePayment extends SmallProgram * @param string|null $openId * @param string $payer_client_ip * @return array - * @throws Exception + * @throws */ #[ArrayShape(['code_url' => "string"])] public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array diff --git a/wx/V3/WxV3Payment.php b/wx/V3/WxV3Payment.php index 66e2cf9..0d51515 100644 --- a/wx/V3/WxV3Payment.php +++ b/wx/V3/WxV3Payment.php @@ -3,7 +3,6 @@ namespace wchat\wx\V3; use Exception; -use Kiri\Client; use wchat\wx\SmallProgram; class WxV3Payment extends SmallProgram @@ -19,7 +18,7 @@ class WxV3Payment extends SmallProgram * @param string|null $openId * @param string $payer_client_ip * @return array - * @throws Exception + * @throws */ public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array { diff --git a/wx/V3/WxV3PaymentNotify.php b/wx/V3/WxV3PaymentNotify.php index d792ded..f6638f7 100644 --- a/wx/V3/WxV3PaymentNotify.php +++ b/wx/V3/WxV3PaymentNotify.php @@ -5,7 +5,6 @@ namespace wchat\wx\V3; use Exception; use OpenSSLAsymmetricKey; use Psr\Http\Message\RequestInterface; -use wchat\common\PayConfig; use wchat\wx\SmallProgram; use wchat\wx\V3\Notify\GoodsDetail; use wchat\wx\V3\Notify\NotifyModel; @@ -50,7 +49,7 @@ class WxV3PaymentNotify extends SmallProgram /** * @param RequestInterface $request * @return bool - * @throws Exception + * @throws */ public function verify(RequestInterface $request): bool { diff --git a/wx/V3/WxV3PaymentTait.php b/wx/V3/WxV3PaymentTait.php index 5218e99..a4b3ca3 100644 --- a/wx/V3/WxV3PaymentTait.php +++ b/wx/V3/WxV3PaymentTait.php @@ -4,7 +4,6 @@ namespace wchat\wx\V3; use Exception; use Kiri\Client; -use wchat\common\AppConfig; use wchat\common\Help; @@ -69,7 +68,7 @@ trait WxV3PaymentTait /** * @param string $orderNo * @return array - * @throws Exception + * @throws */ public function searchByOutTradeNo(string $orderNo): array { @@ -80,7 +79,7 @@ trait WxV3PaymentTait /** * @param string $orderNo * @return array - * @throws Exception + * @throws */ public function searchByTransactionId(string $orderNo): array { @@ -91,7 +90,7 @@ trait WxV3PaymentTait /** * @param string $parseUrl * @return array - * @throws Exception + * @throws */ private function search(string $parseUrl): array { @@ -112,7 +111,7 @@ trait WxV3PaymentTait * @param string $canonical_url * @param string $body * @return string - * @throws Exception + * @throws */ public function signature(string $http_method, string $canonical_url, string $body = ''): string { diff --git a/wx/V3/WxV3Withdrawal.php b/wx/V3/WxV3Withdrawal.php index 76e3799..84b9dc7 100644 --- a/wx/V3/WxV3Withdrawal.php +++ b/wx/V3/WxV3Withdrawal.php @@ -20,7 +20,7 @@ class WxV3Withdrawal extends SmallProgram * @param string $batch_remark * @param TransferDetail[] $details * @return array - * @throws Exception + * @throws */ public function payment(string $orderNo, string $batch_name, string $batch_remark, array $details): array { diff --git a/wx/WxFactory.php b/wx/WxFactory.php index 0ed253d..f8d4e29 100644 --- a/wx/WxFactory.php +++ b/wx/WxFactory.php @@ -3,7 +3,6 @@ namespace wchat\wx; use Kiri\Di\Container; -use ReflectionException; use wchat\common\AppConfig; class WxFactory @@ -14,12 +13,12 @@ class WxFactory * @param string $class * @param AppConfig $config * @return object|null - * @throws ReflectionException + * @throws */ public static function get(string $class, AppConfig $config): ?object { $container = Container::instance(); - $object = $container->get($class); + $object = $container->get($class); $object->setPayConfig($config); return $object; }