Skip to content

Commit c05ee1e

Browse files
LuborRodRodion Liuborets
andauthored
SDK-1746 Return stdClass after jsonSerialize (#265)
Co-authored-by: Rodion Liuborets <[email protected]>
1 parent e93c02d commit c05ee1e

24 files changed

+86
-68
lines changed

src/Aml/Address.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\Aml;
66

7+
use stdClass;
78
use Yoti\Util\Json;
89

910
class Address implements \JsonSerializable
@@ -52,11 +53,11 @@ public function getPostcode(): ?string
5253
/**
5354
* Get address data.
5455
*
55-
* @return array<string, string|Country|null>
56+
* @return stdClass
5657
*/
57-
public function jsonSerialize(): array
58+
public function jsonSerialize(): stdClass
5859
{
59-
return [
60+
return (object) [
6061
self::POSTCODE_ATTR => $this->getPostcode(),
6162
self::COUNTRY_ATTR => $this->getCountry(),
6263
];

src/Aml/Profile.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\Aml;
66

7+
use stdClass;
78
use Yoti\Util\Json;
89

910
class Profile implements \JsonSerializable
@@ -92,11 +93,11 @@ public function getAmlAddress(): Address
9293
/**
9394
* Get Aml profile data.
9495
*
95-
* @return array<string, mixed>
96+
* @return stdClass
9697
*/
97-
public function jsonSerialize(): array
98+
public function jsonSerialize(): stdClass
9899
{
99-
return [
100+
return (object) [
100101
self::GIVEN_NAMES_ATTR => $this->getGivenNames(),
101102
self::FAMILY_NAME_ATTR => $this->getFamilyName(),
102103
self::SSN_ATTR => $this->getSsn(),

src/DocScan/Session/Create/Check/Contracts/RequestedWatchlistAdvancedCaConfig.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\DocScan\Session\Create\Check\Contracts;
66

7+
use stdClass;
78
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaMatchingStrategy;
89
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaSources;
910
use Yoti\DocScan\Session\Create\Check\RequestedCheckConfigInterface;
@@ -75,11 +76,11 @@ public function getMatchingStrategy(): RequestedCaMatchingStrategy
7576
}
7677

7778
/**
78-
* @return array<string, mixed>
79+
* @return stdClass
7980
*/
80-
public function jsonSerialize(): array
81+
public function jsonSerialize(): stdClass
8182
{
82-
return [
83+
return (object) [
8384
'remove_deceased' => $this->getRemoveDeceased(),
8485
'share_url' => $this->getShareUrl(),
8586
'sources' => $this->getSources(),

src/DocScan/Session/Create/Check/RequestedCheck.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
namespace Yoti\DocScan\Session\Create\Check;
66

77
use JsonSerializable;
8+
use stdClass;
89
use Yoti\Util\Json;
910

1011
abstract class RequestedCheck implements JsonSerializable
1112
{
1213
/**
13-
* @return array<string, mixed>
14+
* @return stdClass
1415
*/
15-
public function jsonSerialize(): array
16+
public function jsonSerialize(): stdClass
1617
{
17-
return Json::withoutNullValues([
18+
return (object) Json::withoutNullValues([
1819
'type' => $this->getType(),
1920
'config' => $this->getConfig()
2021
]);

src/DocScan/Session/Create/Check/RequestedDocumentAuthenticityCheckConfig.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yoti\DocScan\Session\Create\Check;
66

7+
use stdClass;
78
use Yoti\Util\Json;
89

910
class RequestedDocumentAuthenticityCheckConfig implements RequestedCheckConfigInterface
@@ -29,9 +30,9 @@ public function __construct(?string $manualCheck, ?IssuingAuthoritySubCheck $iss
2930
}
3031

3132
/**
32-
* @return \stdClass
33+
* @return stdClass
3334
*/
34-
public function jsonSerialize(): \stdClass
35+
public function jsonSerialize(): stdClass
3536
{
3637
return (object) Json::withoutNullValues([
3738
'manual_check' => $this->getManualCheck(),

src/DocScan/Session/Create/Check/RequestedFaceMatchCheckConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check;
66

7+
use stdClass;
8+
79
class RequestedFaceMatchCheckConfig implements RequestedCheckConfigInterface
810
{
911
/**
@@ -17,11 +19,11 @@ public function __construct(string $manualCheck)
1719
}
1820

1921
/**
20-
* @return array<string, mixed>
22+
* @return stdClass
2123
*/
22-
public function jsonSerialize(): array
24+
public function jsonSerialize(): stdClass
2325
{
24-
return [
26+
return (object) [
2527
'manual_check' => $this->getManualCheck(),
2628
];
2729
}

src/DocScan/Session/Create/Check/RequestedLivenessConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check;
66

7+
use stdClass;
8+
79
class RequestedLivenessConfig implements RequestedCheckConfigInterface
810
{
911
/**
@@ -23,11 +25,11 @@ public function __construct(string $livenessType, int $maxRetries)
2325
}
2426

2527
/**
26-
* @return array<string, mixed>
28+
* @return stdClass
2729
*/
28-
public function jsonSerialize(): array
30+
public function jsonSerialize(): stdClass
2931
{
30-
return [
32+
return (object) [
3133
'liveness_type' => $this->getLivenessType(),
3234
'max_retries' => $this->getMaxRetries(),
3335
];

src/DocScan/Session/Create/Check/RequestedWatchlistScreeningConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Yoti\DocScan\Session\Create\Check;
66

7+
use stdClass;
8+
79
/**
810
* Class RequestedWatchlistScreeningConfig
911
* @package Yoti\DocScan\Session\Create\Check
@@ -25,11 +27,11 @@ public function __construct(array $categories)
2527
}
2628

2729
/**
28-
* @return array<string, mixed>
30+
* @return stdClass
2931
*/
30-
public function jsonSerialize(): array
32+
public function jsonSerialize(): stdClass
3133
{
32-
return [
34+
return (object) [
3335
'categories' => $this->categories,
3436
];
3537
}

src/DocScan/Session/Create/SessionSpecification.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Yoti\DocScan\Session\Create;
66

77
use JsonSerializable;
8+
use stdClass;
89
use Yoti\DocScan\Session\Create\Check\RequestedCheck;
910
use Yoti\DocScan\Session\Create\Filters\RequiredDocument;
1011
use Yoti\DocScan\Session\Create\Task\RequestedTask;
@@ -107,11 +108,11 @@ public function __construct(
107108
}
108109

109110
/**
110-
* @return array<string, mixed>
111+
* @return stdClass
111112
*/
112-
public function jsonSerialize(): array
113+
public function jsonSerialize(): stdClass
113114
{
114-
return Json::withoutNullValues([
115+
return (object) Json::withoutNullValues([
115116
'client_session_token_ttl' => $this->getClientSessionTokenTtl(),
116117
'session_deadline' => $this->getSessionDeadline(),
117118
'resources_ttl' => $this->getResourcesTtl(),

src/DocScan/Session/Create/Task/RequestedTask.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
namespace Yoti\DocScan\Session\Create\Task;
66

77
use JsonSerializable;
8+
use stdClass;
89
use Yoti\Util\Json;
910

1011
abstract class RequestedTask implements JsonSerializable
1112
{
1213
/**
13-
* @return array<string, mixed>
14+
* @return stdClass
1415
*/
15-
public function jsonSerialize(): array
16+
public function jsonSerialize(): stdClass
1617
{
17-
return Json::withoutNullValues([
18+
return (object)Json::withoutNullValues([
1819
'type' => $this->getType(),
1920
'config' => $this->getConfig()
2021
]);

0 commit comments

Comments
 (0)