Skip to content

Commit a56a9fa

Browse files
authored
Merge pull request #18 from ivinteractive/main
PHP 8.4 support
2 parents 9ec4ad5 + e47169e commit a56a9fa

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
php: [8.3]
14+
php: [8.3, 8.4]
1515

1616
steps:
1717
- name: Checkout code

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
matrix:
13-
php: [8.1, 8.2, 8.3]
13+
php: [8.1, 8.2, 8.3, 8.4]
1414

1515
name: Tests on PHP ${{ matrix.php }} - ${{ matrix.stability }}
1616

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)