Skip to content

Commit 89aeaac

Browse files
authored
Merge pull request #143 from matsuo/update-communication-provider
Resolve the "Call to function property_exists() with $this and 'responseBody' will always evaluate to true" error detected by PHPStan
2 parents 15060aa + 068a537 commit 89aeaac

1 file changed

Lines changed: 30 additions & 32 deletions

File tree

src/Supporting/CommunicationProvider.php

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -729,38 +729,36 @@ public function storeToProperties(): void
729729
$this->returnedCount = null;
730730
$this->errorMessage = null;
731731

732-
if (property_exists($this, 'responseBody')) {
733-
$rbody = $this->responseBody;
734-
if (is_object($rbody)) {
735-
if (property_exists($rbody, 'messages')) {
736-
$result = $rbody->messages[0];
737-
$this->httpStatus = $this->getCurlInfo("http_code");
738-
$this->errorCode = property_exists($result, 'code') ? $result->code : -1;
739-
$this->errorMessage = property_exists($result, 'message') && $result->code != 0 ? $result->message : null;
740-
}
741-
if (property_exists($rbody, 'response')) {
742-
$result = $rbody->response;
743-
$this->scriptError = property_exists($result, 'scriptError') ? $result->scriptError : null;
744-
$this->scriptResult = property_exists($result, 'scriptResult') ? $result->scriptResult : null;
745-
$this->scriptErrorPrerequest = property_exists($result, 'scriptError.prerequest') ?
746-
$result->{'scriptError.prerequest'} : null;
747-
$this->scriptResultPrerequest = property_exists($result, 'scriptResult.prerequest') ?
748-
$result->{'scriptResult.prerequest'} : null;
749-
$this->scriptErrorPresort = property_exists($result, "scriptError.presort") ?
750-
$result->{"scriptError.presort"} : null;
751-
$this->scriptResultPresort = property_exists($result, "scriptResult.presort") ?
752-
$result->{"scriptResult.presort"} : null;
753-
if (property_exists($result, 'dataInfo')) {
754-
$dataInfo = $result->dataInfo;
755-
$this->targetTable = property_exists($dataInfo, 'table') ?
756-
$dataInfo->table : null;
757-
$this->totalCount = property_exists($dataInfo, 'totalRecordCount') ?
758-
$dataInfo->totalRecordCount : null;
759-
$this->foundCount = property_exists($dataInfo, 'foundCount') ?
760-
$dataInfo->foundCount : null;
761-
$this->returnedCount = property_exists($dataInfo, 'returnedCount') ?
762-
$dataInfo->returnedCount : null;
763-
}
732+
$rbody = $this->responseBody;
733+
if (is_object($rbody)) {
734+
if (property_exists($rbody, 'messages')) {
735+
$result = $rbody->messages[0];
736+
$this->httpStatus = $this->getCurlInfo("http_code");
737+
$this->errorCode = property_exists($result, 'code') ? $result->code : -1;
738+
$this->errorMessage = property_exists($result, 'message') && $result->code != 0 ? $result->message : null;
739+
}
740+
if (property_exists($rbody, 'response')) {
741+
$result = $rbody->response;
742+
$this->scriptError = property_exists($result, 'scriptError') ? $result->scriptError : null;
743+
$this->scriptResult = property_exists($result, 'scriptResult') ? $result->scriptResult : null;
744+
$this->scriptErrorPrerequest = property_exists($result, 'scriptError.prerequest') ?
745+
$result->{'scriptError.prerequest'} : null;
746+
$this->scriptResultPrerequest = property_exists($result, 'scriptResult.prerequest') ?
747+
$result->{'scriptResult.prerequest'} : null;
748+
$this->scriptErrorPresort = property_exists($result, "scriptError.presort") ?
749+
$result->{"scriptError.presort"} : null;
750+
$this->scriptResultPresort = property_exists($result, "scriptResult.presort") ?
751+
$result->{"scriptResult.presort"} : null;
752+
if (property_exists($result, 'dataInfo')) {
753+
$dataInfo = $result->dataInfo;
754+
$this->targetTable = property_exists($dataInfo, 'table') ?
755+
$dataInfo->table : null;
756+
$this->totalCount = property_exists($dataInfo, 'totalRecordCount') ?
757+
$dataInfo->totalRecordCount : null;
758+
$this->foundCount = property_exists($dataInfo, 'foundCount') ?
759+
$dataInfo->foundCount : null;
760+
$this->returnedCount = property_exists($dataInfo, 'returnedCount') ?
761+
$dataInfo->returnedCount : null;
764762
}
765763
}
766764
}

0 commit comments

Comments
 (0)