Skip to content

Commit

Permalink
php: Update all major dependencies (major) (#597)
Browse files Browse the repository at this point in the history
* php: Update all major dependencies

* This change is inspired by the original repo from the dependency

https://github.com/cweiske/jsonmapper/blob/8c64d8d444a5d764c641ebe97e0e3bc72b25bf6c/tests/Enums_PHP81_Test.php#L17

I don't know, why they have the test specifically called php8.1 because it does not work with 8.2 and 8.3 either without the setting

---------

Co-authored-by: Renovate Bot <[email protected]>
  • Loading branch information
ata-no-one and Renovate Bot authored Sep 9, 2024
1 parent 8fb7243 commit 81fcc46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions php/src/vaas/Vaas.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Vaas
private LoggerInterface $_logger;
private VaasOptions $_options;
private HttpClient $_httpClient;
private JsonMapper $_jsonMapper;

/**
*/
Expand All @@ -61,6 +62,8 @@ public function __construct(?string $vaasUrl, ?LoggerInterface $logger = new Nul
$this->_logger->debug("Url: " . $vaasUrl);
if ($vaasUrl)
$this->_vaasUrl = $vaasUrl;
$this->_jsonMapper = new JsonMapper();
$this->_jsonMapper->bStrictObjectTypeChecking = false;
}

/**
Expand Down Expand Up @@ -248,14 +251,14 @@ private function _waitForAuthResponse(): AuthResponse
$result = $result->getContent();
$this->_logger->debug("Result", json_decode($result, true));
$genericObject = \json_decode($result);
$resultObject = (new JsonMapper())->map(
$resultObject = $this->_jsonMapper->map(
$genericObject,
new BaseMessage()
BaseMessage::class
);
if ($resultObject->kind == Kind::AuthResponse) {
$authResponse = (new JsonMapper())->map(
$authResponse = $this->_jsonMapper->map(
$genericObject,
new AuthResponse()
AuthResponse::class
);
$this->_logger->debug($result);
if ($authResponse->success === false) {
Expand All @@ -265,9 +268,9 @@ private function _waitForAuthResponse(): AuthResponse
}
if ($resultObject->kind == Kind::Error) {
try {
$errorResponse = (new JsonMapper())->map(
$errorResponse = $this->_jsonMapper->map(
$genericObject,
new Error()
Error::class
);
} catch (JsonMapper_Exception $e) {
// Received error type is not deserializable to Error
Expand Down Expand Up @@ -320,13 +323,13 @@ private function _waitForVerdict(string $guid): VerdictResponse
$result = $result->getContent();
$this->_logger->debug("Result", json_decode($result, true));
$resultObject = json_decode($result);
$baseMessage = (new JsonMapper())->map(
$baseMessage = $this->_jsonMapper->map(
$resultObject,
new BaseMessage()
);
if ($baseMessage->kind == Kind::Error) {
try {
$errorResponse = (new JsonMapper())->map(
$errorResponse = $this->_jsonMapper->map(
$resultObject,
new Error()
);
Expand All @@ -340,7 +343,7 @@ private function _waitForVerdict(string $guid): VerdictResponse
continue;
}

$verdictResponse = (new JsonMapper())->map(
$verdictResponse = $this->_jsonMapper->map(
$resultObject,
new VerdictResponse()
);
Expand Down
2 changes: 1 addition & 1 deletion php/src/vaas/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"php": "^8.1",
"ramsey/uuid": "^4.7 || ^4.2",
"textalk/websocket": "^1.6 || ^1.5",
"netresearch/jsonmapper": "^4.4",
"netresearch/jsonmapper": "^5.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"amphp/http-client": "5.1.0",
"amphp/file": "3.1.1"
Expand Down

0 comments on commit 81fcc46

Please sign in to comment.