Skip to content

Commit 5921aa5

Browse files
brpauwelskouinkouin
authored andcommitted
Exception code should be integer
Passing `null` as exception code is deprecated: ``` Deprecated: Exception::__construct(): Passing null to parameter #2 ($code) of type int is deprecated ```
1 parent c8229c1 commit 5921aa5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Bpack247.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function doCall($url, $body = null, $method = 'GET')
132132
&& ($xml->getName() == 'businessException' || $xml->getName() == 'systemException')
133133
) {
134134
$message = (string) $xml->message;
135-
$code = isset($xml->code) ? (int) $xml->code : null;
135+
$code = isset($xml->code) ? (int) $xml->code : 0;
136136
switch ($xml->getName()) {
137137
case 'businessException':
138138
throw new BpostApiBusinessException($message, $code);

src/Bpost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private function doCall(HttpRequestBuilderInterface $builder)
276276
) {
277277
// message
278278
$message = (string) $xml->error;
279-
$code = isset($xml->code) ? (int) $xml->code : null;
279+
$code = isset($xml->code) ? (int) $xml->code : 0;
280280

281281
// throw exception
282282
throw new BpostInvalidSelectionException($message, $code);

0 commit comments

Comments
 (0)