Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
calchen authored and StyleCIBot committed Dec 5, 2021
1 parent 271af20 commit 0a5ce89
Show file tree
Hide file tree
Showing 23 changed files with 70 additions and 82 deletions.
9 changes: 5 additions & 4 deletions src/DingtalkRobot.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function __construct()
/**
* 指定机器人名称,默认为 default.
*
* @param string $name
*
* @param string $name
* @return $this
*
* @throws Exception
*/
public function robot($name = 'default'): self
Expand Down Expand Up @@ -126,9 +126,9 @@ public function robot($name = 'default'): self
/**
* 将创建好的 message 对象保存到当前对象中以便后续发送
*
* @param Message $message
*
* @param Message $message
* @return $this
*
* @throws Exception
*/
public function setMessage(Message $message): self
Expand Down Expand Up @@ -178,6 +178,7 @@ private function getHttpClient(): ClientInterface
* 发起请求,返回的内容与直接调用钉钉接口返回的内容一致.
*
* @return array
*
* @throws Exception
*/
public function send(): array
Expand Down
4 changes: 2 additions & 2 deletions src/DingtalkRobotChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DingtalkRobotChannel
/**
* Send the given notification.
*
* @param $notifiable
* @param Notification $notification
* @param $notifiable
* @param Notification $notification
*
* @throws Exception
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Exceptions/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class Exception extends \Exception
/**
* 重写构造方法,直接根据 code 取错误消息.
*
* @param string $message
* @param int $code
* @param Throwable|null $previous
* @param string $message
* @param int $code
* @param Throwable|null $previous
*/
public function __construct($message = '', $code = 0, Throwable $previous = null)
{
Expand Down
32 changes: 15 additions & 17 deletions src/Message/ActionCardMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class ActionCardMessage extends Message
/**
* ActionCardMessage constructor.
*
* @param string|null $title 首屏会话透出的展示内容
* @param string|null $text markdown 格式的消息
* @param int|null $hideAvatar 0-按钮竖直排列,1-按钮横向排列
* @param int|null $btnOrientation 0-正常发消息者头像,1-隐藏发消息者头像
* @param string|null $title 首屏会话透出的展示内容
* @param string|null $text markdown 格式的消息
* @param int|null $hideAvatar 0-按钮竖直排列,1-按钮横向排列
* @param int|null $btnOrientation 0-正常发消息者头像,1-隐藏发消息者头像
*
* @throws InvalidConfigurationException
*/
Expand All @@ -48,12 +48,12 @@ public function __construct(string $title = null, string $text = null, $hideAvat
/**
* ActionCard 的整体跳转和独立跳转两种类型中 title text hideAvatar btnOrientation 都是共同拥有的.
*
* @param string $title 首屏会话透出的展示内容
* @param string $text markdown 格式的消息
* @param int|null $hideAvatar 0-按钮竖直排列,1-按钮横向排列
* @param int|null $btnOrientation 0-正常发消息者头像,1-隐藏发消息者头像
*
* @param string $title 首屏会话透出的展示内容
* @param string $text markdown 格式的消息
* @param int|null $hideAvatar 0-按钮竖直排列,1-按钮横向排列
* @param int|null $btnOrientation 0-正常发消息者头像,1-隐藏发消息者头像
* @return ActionCardMessage
*
* @throws InvalidConfigurationException
*/
public function setMessage(string $title, string $text, $hideAvatar = null, $btnOrientation = null): self
Expand Down Expand Up @@ -85,10 +85,9 @@ public function setMessage(string $title, string $text, $hideAvatar = null, $btn
/**
* 设置整体跳转类型参数,与独立跳转互斥.
*
* @param string $singleTitle 单个按钮的方案。(设置此项和singleURL后btns无效。)
* @param string $singleUrl 点击singleTitle按钮触发的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
*
* @param string $singleTitle 单个按钮的方案。(设置此项和singleURL后btns无效。)
* @param string $singleUrl 点击singleTitle按钮触发的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
* @return $this
*/
public function setSingle(string $singleTitle, string $singleUrl, bool $pcSlide = true): self
Expand All @@ -103,10 +102,9 @@ public function setSingle(string $singleTitle, string $singleUrl, bool $pcSlide
/**
* 设置独立跳转类型按钮参数,可设置多个,与整体跳转互斥.
*
* @param string $title 按钮方案
* @param string $actionUrl 点击按钮触发的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
*
* @param string $title 按钮方案
* @param string $actionUrl 点击按钮触发的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
* @return ActionCardMessage
*/
public function addButton(string $title, string $actionUrl, bool $pcSlide = true): self
Expand Down
4 changes: 2 additions & 2 deletions src/Message/AtTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ trait AtTrait
/**
* 通过手机号码指定“被@人列表”.
*
* @param string|array $mobiles 被@人的手机号(在text内容里要有@手机号)
*
* @param string|array $mobiles 被@人的手机号(在text内容里要有@手机号)
* @return Message
*
* @throws InvalidArgumentException
*/
public function at($mobiles): self
Expand Down
9 changes: 4 additions & 5 deletions src/Message/FeedCardMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ public function setMessage()
/**
* 增加链接.
*
* @param string $title 单条信息文本
* @param string $messageUrl 点击单条信息到跳转链接
* @param string $picUrl 单条信息后面图片的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
*
* @param string $title 单条信息文本
* @param string $messageUrl 点击单条信息到跳转链接
* @param string $picUrl 单条信息后面图片的URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
* @return FeedCardMessage
*/
public function addLink(string $title, string $messageUrl, string $picUrl, bool $pcSlide = true): self
Expand Down
21 changes: 10 additions & 11 deletions src/Message/LinkMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class LinkMessage extends Message
/**
* LinkMessage constructor.
*
* @param string|null $title 消息标题
* @param string|null $text 消息内容。如果太长只会部分展示
* @param string|null $messageUrl 点击消息跳转的 URL
* @param string $picUrl 图片 URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
* @param string|null $title 消息标题
* @param string|null $text 消息内容。如果太长只会部分展示
* @param string|null $messageUrl 点击消息跳转的 URL
* @param string $picUrl 图片 URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
*/
public function __construct(
string $title = null,
Expand All @@ -31,12 +31,11 @@ public function __construct(
}

/**
* @param string $title 消息标题
* @param string $text 消息内容。如果太长只会部分展示
* @param string $messageUrl 点击消息跳转的 URL
* @param string $picUrl 图片 URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
*
* @param string $title 消息标题
* @param string $text 消息内容。如果太长只会部分展示
* @param string $messageUrl 点击消息跳转的 URL
* @param string $picUrl 图片 URL
* @param bool $pcSlide 链接是否在 PC 端侧栏打开,true 在 PC 端侧栏打开;false 在系统默认浏览器
* @return LinkMessage
*/
public function setMessage(
Expand Down
9 changes: 4 additions & 5 deletions src/Message/MarkdownMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class MarkdownMessage extends Message
/**
* MarkdownMessage constructor.
*
* @param string|null $title 首屏会话透出的展示内容
* @param string|null $text markdown 格式的消息
* @param string|null $title 首屏会话透出的展示内容
* @param string|null $text markdown 格式的消息
*/
public function __construct(string $title = null, string $text = null)
{
Expand All @@ -25,9 +25,8 @@ public function __construct(string $title = null, string $text = null)
}

/**
* @param string $title 首屏会话透出的展示内容
* @param string $text markdown 格式的消息
*
* @param string $title 首屏会话透出的展示内容
* @param string $text markdown 格式的消息
* @return MarkdownMessage
*/
public function setMessage(string $title, string $text): self
Expand Down
8 changes: 3 additions & 5 deletions src/Message/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function getMessage(): array
/**
* 设置接受消息的机器人名称.
*
* @param string $robot
*
* @param string $robot
* @return Message
*/
public function setRobot(string $robot): self
Expand All @@ -57,9 +56,8 @@ public function getRobot(): string
*
* @link https://ding-doc.dingtalk.com/doc#/serverapi2/iat9q8/e300ae98
*
* @param string $url
* @param bool $pcSlide
*
* @param string $url
* @param bool $pcSlide
* @return string
*/
public function getFinalUrl(string $url, bool $pcSlide = true): string
Expand Down
5 changes: 2 additions & 3 deletions src/Message/TextMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TextMessage extends Message
/**
* TextMessage constructor.
*
* @param string|null $content 消息内容
* @param string|null $content 消息内容
*/
public function __construct(string $content = null)
{
Expand All @@ -24,8 +24,7 @@ public function __construct(string $content = null)
}

/**
* @param string $content 消息内容
*
* @param string $content 消息内容
* @return TextMessage
*/
public function setMessage(string $content): self
Expand Down
2 changes: 1 addition & 1 deletion src/Robot.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getName(): string
}

/**
* @param string $name
* @param string $name
*/
public function setName(string $name)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Notifications/ActionCardIndependentJumpNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidConfigurationException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidConfigurationException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidConfigurationException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
4 changes: 2 additions & 2 deletions tests/Notifications/ActionCardOverallJumpNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidConfigurationException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
3 changes: 1 addition & 2 deletions tests/Notifications/EmptyNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*/
public function toDingTalkRobot($notifiable)
Expand Down
3 changes: 1 addition & 2 deletions tests/Notifications/FeedCardNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
3 changes: 1 addition & 2 deletions tests/Notifications/LinkNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
3 changes: 1 addition & 2 deletions tests/Notifications/MarkdownAtAllNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
4 changes: 2 additions & 2 deletions tests/Notifications/MarkdownAtPersonNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidArgumentException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
3 changes: 1 addition & 2 deletions tests/Notifications/TextAtAllNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
4 changes: 2 additions & 2 deletions tests/Notifications/TextAtInvalidNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidArgumentException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down
4 changes: 2 additions & 2 deletions tests/Notifications/TextAtPersonNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function via($notifiable)
}

/**
* @param Robot $notifiable
*
* @param Robot $notifiable
* @return Message
*
* @throws InvalidArgumentException
*/
public function toDingTalkRobot($notifiable): Message
Expand Down

0 comments on commit 0a5ce89

Please sign in to comment.