Skip to content

Commit

Permalink
Merge pull request #2 from php-soap/invalid-type
Browse files Browse the repository at this point in the history
Use bool  for SoapClient::__doRequest() $one_way
  • Loading branch information
veewee authored Nov 12, 2021
2 parents c79f6fd + 829617d commit 6039f26
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="psalm" version="^4.3.1" installed="4.8.1" location="./tools/psalm.phar" copy="true"/>
<phar name="psalm" version="^4.3.1" installed="4.12.0" location="./tools/psalm.phar" copy="true"/>
<phar name="php-cs-fixer" version="^2.18.2" installed="2.19.0" location="./tools/php-cs-fixer.phar" copy="true"/>
</phive>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ext-soap": "*",
"ext-dom": "*",
"azjezz/psl": "^1.7",
"php-soap/engine": "^1.0",
"php-soap/engine": "^1.1",
"php-soap/wsdl": "^1.0",
"symfony/options-resolver": "^5.3"
},
Expand Down
4 changes: 3 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
forbidEcho="true"
strictBinaryOperands="true"
phpVersion="8.0"
allowPhpStormGenerics="true"
allowStringToStandInForClass="true"
rememberPropertyAssignmentsAfterCall="false"
skipChecksOnUnresolvableIncludes="false"
Expand All @@ -20,4 +19,7 @@
<directory name="tests" />
</ignoreFiles>
</projectFiles>
<stubs>
<file name="stubs/SoapClient.phpstub" />
</stubs>
</psalm>
16 changes: 9 additions & 7 deletions src/AbusedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ public static function createFromOptions(ExtSoapOptions $options): self
return new self($options->getWsdl(), $options->getOptions());
}

/**
* @psalm-suppress RedundantCastGivenDocblockType - Whatever psalm says ... $oneWay can be bool :-(
*/
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
{
$this->storedRequest = new SoapRequest($request, $location, $action, $version, (int) $oneWay);
public function __doRequest(
string $request,
string $location,
string $action,
int $version,
bool $one_way = false
): string {
$this->storedRequest = new SoapRequest($request, $location, $action, $version, $one_way);

return $this->storedResponse ? $this->storedResponse->getPayload() : '';
}
Expand All @@ -58,7 +60,7 @@ public function doActualRequest(
string $location,
string $action,
int $version,
int $oneWay = 0
bool $oneWay = false
): string {
$this->__last_request = $request;
$this->__last_response = parent::__doRequest($request, $location, $action, $version, $oneWay);
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/TypeConverter/TypeConverterCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
final class TypeConverterCollection implements IteratorAggregate
{
/**
* @var array|TypeConverterInterface[]
* @var array<TypeConverterInterface>
*/
private array $converters = [];

Expand Down Expand Up @@ -81,7 +81,7 @@ public function has(TypeConverterInterface $converter): bool
}

/**
* @return ArrayIterator|TypeConverterInterface[]
* @return ArrayIterator<array-key, TypeConverterInterface>
*/
public function getIterator(): ArrayIterator
{
Expand Down
11 changes: 11 additions & 0 deletions stubs/SoapClient.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);

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) {}
}
Binary file modified tools/psalm.phar
Binary file not shown.

0 comments on commit 6039f26

Please sign in to comment.