Skip to content

Commit

Permalink
PHP 8.4 - Deprecation Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-burrell committed Jan 20, 2025
1 parent 416dd3e commit 1a36657
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Slack/BlockKit/Blocks/ContextBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function id(string $id): self
/**
* Add an image element to the block.
*/
public function image(string $imageUrl, string $altText = null): ImageElement
public function image(string $imageUrl, ?string $altText = null): ImageElement
{
return tap(new ImageElement($imageUrl, $altText), function (ImageElement $element) {
$this->elements[] = $element;
Expand Down
2 changes: 1 addition & 1 deletion src/Slack/BlockKit/Blocks/HeaderBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HeaderBlock implements BlockContract
/**
* Create a new header block instance.
*/
public function __construct(string $text, Closure $callback = null)
public function __construct(string $text, ?Closure $callback = null)
{
$this->text = $object = new PlainTextOnlyTextObject($text, 150);

Expand Down
2 changes: 1 addition & 1 deletion src/Slack/BlockKit/Blocks/ImageBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ImageBlock implements BlockContract
/**
* Create a new image block instance.
*/
public function __construct(string $url, string $altText = null)
public function __construct(string $url, ?string $altText = null)
{
if (strlen($url) > 3000) {
throw new InvalidArgumentException('Maximum length for the url field is 3000 characters.');
Expand Down
4 changes: 2 additions & 2 deletions src/Slack/BlockKit/Elements/ButtonElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ButtonElement implements ElementContract
/**
* Create a new button element instance.
*/
public function __construct(string $text, Closure $callback = null)
public function __construct(string $text, ?Closure $callback = null)
{
$this->text = new PlainTextOnlyTextObject($text, 75);

Expand Down Expand Up @@ -155,7 +155,7 @@ public function danger(): self
/**
* Set the confirm object for the button.
*/
public function confirm(string $text, Closure $callback = null): ConfirmObject
public function confirm(string $text, ?Closure $callback = null): ConfirmObject
{
$this->confirm = $confirm = new ConfirmObject($text);

Expand Down
2 changes: 1 addition & 1 deletion src/Slack/BlockKit/Elements/ImageElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ImageElement implements ElementContract
/**
* Create a new image element instance.
*/
public function __construct(string $url, string $altText = null)
public function __construct(string $url, ?string $altText = null)
{
$this->url = $url;
$this->altText = $altText;
Expand Down
4 changes: 2 additions & 2 deletions src/Slack/SlackMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function dividerBlock(): self
/**
* Add a new Header block to the message.
*/
public function headerBlock(string $text, Closure $callback = null): self
public function headerBlock(string $text, ?Closure $callback = null): self
{
$this->blocks[] = new HeaderBlock($text, $callback);

Expand All @@ -149,7 +149,7 @@ public function headerBlock(string $text, Closure $callback = null): self
/**
* Add a new Image block to the message.
*/
public function imageBlock(string $url, Closure|string $altText = null, Closure $callback = null): self
public function imageBlock(string $url, Closure|string|null $altText = null, ?Closure $callback = null): self
{
if ($altText instanceof Closure) {
$callback = $altText;
Expand Down
4 changes: 2 additions & 2 deletions src/Slack/SlackRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SlackRoute
/**
* Create a new Slack route instance.
*/
public function __construct(string $channel = null, string $token = null)
public function __construct(?string $channel = null, ?string $token = null)
{
$this->channel = $channel;
$this->token = $token;
Expand All @@ -30,7 +30,7 @@ public function __construct(string $channel = null, string $token = null)
/**
* Fluently create a new Slack route instance.
*/
public static function make(string $channel = null, string $token = null): self
public static function make(?string $channel = null, ?string $token = null): self
{
return new self($channel, $token);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Slack/SlackChannelTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SlackChannelTestNotification extends Notification
{
private Closure $callback;

public function __construct(Closure $callback = null)
public function __construct(?Closure $callback = null)
{
$this->callback = $callback ?? function () {
//
Expand Down

0 comments on commit 1a36657

Please sign in to comment.