Skip to content

Commit e47169e

Browse files
committed
Address static analysis issues for PHP 8.4
1 parent 8c0a15c commit e47169e

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace NotificationChannels\Interfax\Exceptions;
44

55
use Exception;
6+
use Throwable;
67
use NotificationChannels\Interfax\InterfaxMessage;
78

89
class CouldNotSendNotification extends Exception
@@ -13,29 +14,34 @@ class CouldNotSendNotification extends Exception
1314
protected array $responseAttributes;
1415

1516
/**
16-
* @param string $message
17-
* @param int $code
18-
* @param Exception|null $previous
19-
* @param InterfaxMessage $interfaxMessage
20-
* @param array<string, mixed> $responseAttributes
17+
* @param InterfaxMessage $message
18+
* @param array<string, mixed> $responseAttributes
19+
* @param string $exceptionMessage
20+
* @return CouldNotSendNotification
2121
*/
22-
final public function __construct(string $message, int $code, Exception $previous = null, InterfaxMessage $interfaxMessage, array $responseAttributes)
22+
public static function serviceRespondedWithAnError(InterfaxMessage $message, array $responseAttributes, string $exceptionMessage = 'The fax failed to send via InterFAX.')
2323
{
24-
parent::__construct($message, $code, $previous);
24+
$exception = new self($exceptionMessage, $responseAttributes['status'], null);
25+
$exception->setInterfaxMessage($message);
26+
$exception->setResponseAttributes($responseAttributes);
27+
28+
return $exception;
29+
}
2530

31+
/**
32+
* @param InterfaxMessage $interfaxMessage
33+
*/
34+
public function setInterfaxMessage(InterfaxMessage $interfaxMessage): void
35+
{
2636
$this->interfaxMessage = $interfaxMessage;
27-
$this->responseAttributes = $responseAttributes;
2837
}
2938

3039
/**
31-
* @param InterfaxMessage $message
32-
* @param array<string, mixed> $responseAttributes
33-
* @param string $exceptionMessage
34-
* @return CouldNotSendNotification
40+
* @param array<string, mixed> $responseAttributes
3541
*/
36-
public static function serviceRespondedWithAnError(InterfaxMessage $message, array $responseAttributes, string $exceptionMessage = 'The fax failed to send via InterFAX.')
42+
public function setResponseAttributes(array $responseAttributes): void
3743
{
38-
return new static($exceptionMessage, $responseAttributes['status'], null, $message, $responseAttributes);
44+
$this->responseAttributes = $responseAttributes;
3945
}
4046

4147
/**

src/InterfaxFile.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ class InterfaxFile extends \Interfax\File
77
/**
88
* File constructor.
99
*
10+
* @param \Interfax\Client $client
1011
* @param resource|string $location
1112
* @param array<string, mixed> $params
1213
*
1314
* @throws \InvalidArgumentException
1415
*/
15-
public function __construct(\Interfax\Client $client, $location, $params = [], \Interfax\GenericFactory $factory = null)
16+
public function __construct(\Interfax\Client $client, $location, $params = [], ?\Interfax\GenericFactory $factory = null)
1617
{
1718
if ($chunkSize = config('services.interfax.chunk_size')) {
1819
static::$DEFAULT_CHUNK_SIZE = $chunkSize;

0 commit comments

Comments
 (0)