Skip to content

Commit 6c08feb

Browse files
committed
Fix exception deprecation notice
Fixed the following deprecation notice: "Exception::__construct(): Passing null to parameter #2 ($code) of type int is deprecated"
1 parent b322bbd commit 6c08feb

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ class CouldNotSendNotification extends \Exception
1515
*/
1616
public function __construct(Response $response, string $message, int $code = null)
1717
{
18-
$this->response = $response;
19-
$this->message = $message;
20-
$this->code = $code ?? $response->getStatusCode();
18+
parent::__construct($message, $code ?? $response->getStatusCode());
2119

22-
parent::__construct($message, $code);
20+
$this->response = $response;
2321
}
2422

2523
/**

tests/ChannelTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313

1414
class ChannelTest extends TestCase
1515
{
16+
protected function setUp(): void
17+
{
18+
parent::setUp();
19+
20+
$this->withoutDeprecationHandling();
21+
}
22+
1623
/** @test */
1724
public function it_can_send_a_notification()
1825
{

tests/MessageTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class MessageTest extends TestCase
1414
public function setUp(): void
1515
{
1616
parent::setUp();
17+
18+
$this->withoutDeprecationHandling();
1719
$this->message = new WebhookMessage();
1820
}
1921

0 commit comments

Comments
 (0)