Skip to content

Commit 66d669f

Browse files
authored
Merge pull request #6 from php-soap/improved-types
Improve type-safety
2 parents a4720b5 + c89d933 commit 66d669f

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

src/Metadata/MethodsParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function parse(SoapClient $client): MethodCollection
2525
{
2626
return new MethodCollection(...array_map(
2727
fn (string $methodString) => $this->parseMethodFromString($methodString),
28-
array_values($client->__getFunctions())
28+
array_values((array)$client->__getFunctions())
2929
));
3030
}
3131

src/Metadata/TypesParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(XsdTypeCollection $xsdTypes)
2727
public function parse(SoapClient $client): TypeCollection
2828
{
2929
$collected = [];
30-
$soapTypes = $client->__getTypes();
30+
$soapTypes = (array) $client->__getTypes();
3131
foreach ($soapTypes as $soapType) {
3232
$properties = [];
3333
$lines = explode("\n", $soapType);

src/Metadata/XsdTypesParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function default(): self
3636
public function parse(SoapClient $client): XsdTypeCollection
3737
{
3838
$collected = [];
39-
$soapTypes = $client->__getTypes();
39+
$soapTypes = (array) $client->__getTypes();
4040
foreach ($soapTypes as $soapType) {
4141
if ($type = $this->detectXsdType($soapType)) {
4242
$collected[] = $type;

stubs/SoapClient.phpstub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,16 @@ class SoapClient
88
* This can be removed once it is fixed in psalm
99
*/
1010
public function __doRequest (string $request, string $location, string $action, int $version, bool $one_way = false): ?string {}
11+
12+
/**
13+
* @see https://github.com/vimeo/psalm/pull/7140
14+
* This can be removed once it is fixed in psalm
15+
*/
16+
public function __getTypes (): ?array {}
17+
18+
/**
19+
* @see https://github.com/vimeo/psalm/pull/7140
20+
* This can be removed once it is fixed in psalm
21+
*/
22+
public function __getFunctions (): ?array {}
1123
}

0 commit comments

Comments
 (0)