Skip to content

Commit

Permalink
Merge pull request #41 from kydever/upgrade-cs
Browse files Browse the repository at this point in the history
Upgrade the version of `cs-fixer`.
  • Loading branch information
hedeqiang authored Apr 21, 2022
2 parents 38372b5 + dd5f65a commit 3b192de
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 113 deletions.
42 changes: 42 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/*
* This file is part of the hedeqiang/umeng.
*
* (c) hedeqiang <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

$header = <<<'EOF'
This file is part of the hedeqiang/umeng.
(c) hedeqiang <[email protected]>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'header_comment' => ['header' => $header],
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'php_unit_construct' => true,
'php_unit_strict' => true,
'visibility_required' => false,
'binary_operator_spaces' => [
'operators' => ['=>' => 'align_single_space_minimal'],
],
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(false);
27 changes: 0 additions & 27 deletions .php_cs

This file was deleted.

8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@
"guzzlehttp/guzzle": "^6.3|^7.0",
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8"
},
"autoload": {
"psr-4": {
"Hedeqiang\\UMeng\\": "./src/"
}
},
"scripts": {
"cs-fix": "php-cs-fixer fix $1"
},
"extra": {
"laravel": {
"providers": [
"Hedeqiang\\UMeng\\PushServiceProvider"
]
}
}
}
}
34 changes: 0 additions & 34 deletions src/Android.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class Android

/**
* Android constructor.
*
* @param array $config
*/
public function __construct(array $config)
{
Expand All @@ -40,10 +38,6 @@ public function __construct(array $config)

/**
* 消息发送
*
* @param array $params
*
* @return array
*/
public function send(array $params): array
{
Expand All @@ -54,10 +48,6 @@ public function send(array $params): array

/**
* 任务类消息状态查询.
*
* @param array $params
*
* @return array
*/
public function status(array $params): array
{
Expand All @@ -68,10 +58,6 @@ public function status(array $params): array

/**
* 任务类消息取消.
*
* @param array $params
*
* @return array
*/
public function cancel(array $params): array
{
Expand All @@ -82,10 +68,6 @@ public function cancel(array $params): array

/**
* 文件上传.
*
* @param array $params
*
* @return array
*/
public function upload(array $params): array
{
Expand All @@ -96,11 +78,6 @@ public function upload(array $params): array

/**
* 返回 代签名的 Url.
*
* @param array $body
* @param string $type
*
* @return string
*/
protected function buildEndpoint(array $body, string $type): string
{
Expand All @@ -122,10 +99,7 @@ protected function buildEndpoint(array $body, string $type): string
/**
* 生成签名.
*
* @param string $endpoint
* @param $body
*
* @return string
*/
protected function getSign(string $endpoint, $body): string
{
Expand All @@ -136,11 +110,6 @@ protected function getSign(string $endpoint, $body): string

/**
* 获取 URL 和参数.
*
* @param array $params
* @param string $type
*
* @return array
*/
protected function getUrl(array $params, string $type): array
{
Expand All @@ -160,10 +129,7 @@ protected function getUrl(array $params, string $type): array
}

/**
* @param string $url
* @param $params
*
* @return array
*/
protected function curl(string $url, $params): array
{
Expand Down
34 changes: 0 additions & 34 deletions src/IOS.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class IOS

/**
* Android constructor.
*
* @param array $config
*/
public function __construct(array $config)
{
Expand All @@ -41,10 +39,6 @@ public function __construct(array $config)

/**
* 消息发送
*
* @param array $params
*
* @return array
*/
public function send(array $params): array
{
Expand All @@ -55,10 +49,6 @@ public function send(array $params): array

/**
* 任务类消息状态查询.
*
* @param array $params
*
* @return array
*/
public function status(array $params): array
{
Expand All @@ -69,10 +59,6 @@ public function status(array $params): array

/**
* 任务类消息取消.
*
* @param array $params
*
* @return array
*/
public function cancel(array $params): array
{
Expand All @@ -83,10 +69,6 @@ public function cancel(array $params): array

/**
* 文件上传.
*
* @param array $params
*
* @return array
*/
public function upload(array $params): array
{
Expand All @@ -97,11 +79,6 @@ public function upload(array $params): array

/**
* 返回 代签名的 Url.
*
* @param array $body
* @param string $type
*
* @return string
*/
protected function buildEndpoint(array $body, string $type): string
{
Expand All @@ -123,10 +100,7 @@ protected function buildEndpoint(array $body, string $type): string
/**
* 生成签名.
*
* @param string $endpoint
* @param $body
*
* @return string
*/
protected function getSign(string $endpoint, $body): string
{
Expand All @@ -137,11 +111,6 @@ protected function getSign(string $endpoint, $body): string

/**
* 获取 URL 和参数.
*
* @param array $params
* @param string $type
*
* @return array
*/
protected function getUrl(array $params, string $type): array
{
Expand All @@ -160,10 +129,7 @@ protected function getUrl(array $params, string $type): array
}

/**
* @param string $url
* @param $params
*
* @return array
*/
protected function curl(string $url, $params): array
{
Expand Down
19 changes: 2 additions & 17 deletions src/Traits/HasHttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ trait HasHttpRequest
/**
* Make a get request.
*
* @param string $endpoint
* @param array $query
* @param array $headers
*
* @return array
*/
protected function get(string $endpoint, array $query = [], array $headers = [])
Expand All @@ -39,9 +35,7 @@ protected function get(string $endpoint, array $query = [], array $headers = [])
/**
* Make a post request.
*
* @param string $endpoint
* @param $options
* @param array $headers
* @param $options
*
* @return array
*/
Expand All @@ -56,9 +50,7 @@ protected function post(string $endpoint, $options, array $headers = [])
/**
* Make a post request with json params.
*
* @param $endpoint
* @param array $params
* @param array $headers
* @param $endpoint
*
* @return array
*/
Expand All @@ -72,8 +64,6 @@ protected function postJson($endpoint, array $params = [], array $headers = [])

/**
* @param $endpoint
* @param array $headers
* @param array $query
*
* @return array
*/
Expand All @@ -88,7 +78,6 @@ protected function delete($endpoint, array $headers = [], array $query = [])
/**
* @param $endpoint
* @param $params
* @param array $headers
*
* @return array
*/
Expand Down Expand Up @@ -128,10 +117,6 @@ protected function getBaseOptions()
/**
* Return http client.
*
* @param array $options
*
* @return Client
*
* @codeCoverageIgnore
*/
protected function getHttpClient(array $options = []): Client
Expand Down

0 comments on commit 3b192de

Please sign in to comment.