Skip to content

Commit

Permalink
Merge pull request #4 from php-soap/dorequest-return-type
Browse files Browse the repository at this point in the history
Fix broken return type
  • Loading branch information
veewee authored Nov 15, 2021
2 parents d4d8cd7 + c993e25 commit f46242c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
29 changes: 29 additions & 0 deletions examples/ext-soap-transport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use Soap\Engine\SimpleEngine;
use Soap\ExtSoapEngine\AbusedClient;
use Soap\ExtSoapEngine\ExtSoapDriver;
use Soap\ExtSoapEngine\ExtSoapOptions;
use Soap\ExtSoapEngine\Transport\ExtSoapClientTransport;
use Soap\ExtSoapEngine\Transport\TraceableTransport;

require_once dirname(__DIR__).'/vendor/autoload.php';

$engine = new SimpleEngine(
ExtSoapDriver::createFromClient(
$client = AbusedClient::createFromOptions(
ExtSoapOptions::defaults('http://www.dneonline.com/calculator.asmx?wsdl', [
'connection_timeout' => 0,
])
)
),
$transport = new TraceableTransport(
$client,
new ExtSoapClientTransport($client)
)
);

$result = $engine->request('Add', [['intA' => 1, 'intB' => 2]]);

var_dump($result);
var_dump($transport->collectLastRequestInfo());
2 changes: 1 addition & 1 deletion src/AbusedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function doActualRequest(
bool $oneWay = false
): string {
$this->__last_request = $request;
$this->__last_response = parent::__doRequest($request, $location, $action, $version, $oneWay);
$this->__last_response = (string) parent::__doRequest($request, $location, $action, $version, $oneWay);

return $this->__last_response;
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/SoapClient.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class SoapClient
* @see https://github.com/vimeo/psalm/issues/6901
* This can be removed once it is fixed in psalm
*/
public function __doRequest (string $request, string $location, string $action, int $version, bool $one_way = false) {}
public function __doRequest (string $request, string $location, string $action, int $version, bool $one_way = false): ?string {}
}

0 comments on commit f46242c

Please sign in to comment.