From a2f68962df3151aa779abad2ee6b27a8f4b15131 Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Mon, 6 Oct 2025 19:56:59 +0900 Subject: [PATCH] fix: add optional to nullable arguments --- src/Card.php | 2 +- src/Components/Button/ImageButton.php | 2 +- src/Components/Button/TextButton.php | 2 +- src/GoogleChatMessage.php | 6 +++--- src/Widgets/Image.php | 2 +- src/Widgets/KeyValue.php | 2 +- src/Widgets/TextParagraph.php | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Card.php b/src/Card.php index e27eba2..d67b665 100644 --- a/src/Card.php +++ b/src/Card.php @@ -28,7 +28,7 @@ class Card implements Arrayable * @param string|null $imageStyle Configure the avatar image style, one of IMAGE or AVATAR * @return self */ - public function header(string $title, string $subtitle = null, string $imageUrl = null, string $imageStyle = null): Card + public function header(string $title, ?string $subtitle = null, ?string $imageUrl = null, ?string $imageStyle = null): Card { $header = [ 'title' => $title, diff --git a/src/Components/Button/ImageButton.php b/src/Components/Button/ImageButton.php index 908d559..10b167c 100644 --- a/src/Components/Button/ImageButton.php +++ b/src/Components/Button/ImageButton.php @@ -54,7 +54,7 @@ public function setIconByUrl(string $url): ImageButton * @param string|null $icon Either an icon name or URL to the icon image * @return self */ - public static function create(string $url = null, string $icon = null): ImageButton + public static function create(?string $url = null, ?string $icon = null): ImageButton { $button = new static; diff --git a/src/Components/Button/TextButton.php b/src/Components/Button/TextButton.php index b2287bf..d8646f6 100644 --- a/src/Components/Button/TextButton.php +++ b/src/Components/Button/TextButton.php @@ -24,7 +24,7 @@ public function text(string $text): TextButton * @param string|null $displayText * @return self */ - public static function create(string $url = null, string $displayText = null): TextButton + public static function create(?string $url = null, ?string $displayText = null): TextButton { $button = new static; diff --git a/src/GoogleChatMessage.php b/src/GoogleChatMessage.php index edeec17..5ccf8f6 100644 --- a/src/GoogleChatMessage.php +++ b/src/GoogleChatMessage.php @@ -157,7 +157,7 @@ public function monospaceBlock(string $message): GoogleChatMessage * @param string|null $displayText * @return self */ - public function link(string $link, string $displayText = null): GoogleChatMessage + public function link(string $link, ?string $displayText = null): GoogleChatMessage { if ($displayText) { $link = "<{$link}|{$displayText}>"; @@ -188,7 +188,7 @@ public function mention(string $userId): GoogleChatMessage * @param string|null $appendText * @return self */ - public function mentionAll(string $prependText = null, string $appendText = null): GoogleChatMessage + public function mentionAll(string $prependText = null, ?string $appendText = null): GoogleChatMessage { $this->text("{$prependText}{$appendText}"); @@ -262,7 +262,7 @@ private function castNestedArrayables($value) * @param string|null $text * @return self */ - public static function create(string $text = null): GoogleChatMessage + public static function create(?string $text = null): GoogleChatMessage { $message = new static; diff --git a/src/Widgets/Image.php b/src/Widgets/Image.php index b717aa1..78da9eb 100644 --- a/src/Widgets/Image.php +++ b/src/Widgets/Image.php @@ -41,7 +41,7 @@ public function onClick(string $url): Image * @param string|null $onClickUrl * @return self */ - public static function create(string $imageUrl = null, string $onClickUrl = null): Image + public static function create(?string $imageUrl = null, ?string $onClickUrl = null): Image { $widget = new static; diff --git a/src/Widgets/KeyValue.php b/src/Widgets/KeyValue.php index a0b96b7..e5bfe88 100644 --- a/src/Widgets/KeyValue.php +++ b/src/Widgets/KeyValue.php @@ -109,7 +109,7 @@ public function button(AbstractButton $button): KeyValue * @param string|null $bottomLabel * @return self */ - public static function create(string $topLabel = null, string $content = null, string $bottomLabel = null): KeyValue + public static function create(?string $topLabel = null, ?string $content = null, ?string $bottomLabel = null): KeyValue { $widget = new static; diff --git a/src/Widgets/TextParagraph.php b/src/Widgets/TextParagraph.php index 2d8ee7a..13424b3 100644 --- a/src/Widgets/TextParagraph.php +++ b/src/Widgets/TextParagraph.php @@ -91,7 +91,7 @@ public function color(string $message, string $hex): TextParagraph * @param string|null $displayText * @return self */ - public function link(string $link, string $displayText = null): TextParagraph + public function link(string $link, ?string $displayText = null): TextParagraph { return $this->text("".($displayText ?? $link).''); } @@ -112,7 +112,7 @@ public function break(): TextParagraph * @param string|null $message * @return self */ - public static function create(string $message = null): TextParagraph + public static function create(?string $message = null): TextParagraph { $widget = new static;