Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compatibility with SoapClient #7140

Merged
merged 2 commits into from Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions dictionaries/CallMap.php
Expand Up @@ -12244,19 +12244,19 @@
'SoapClient::__construct' => ['void', 'wsdl'=>'mixed', 'options='=>'array|null'],
'SoapClient::__doRequest' => ['?string', 'request'=>'string', 'location'=>'string', 'action'=>'string', 'version'=>'int', 'one_way='=>'bool'],
'SoapClient::__getCookies' => ['array'],
'SoapClient::__getFunctions' => ['array'],
'SoapClient::__getLastRequest' => ['string'],
'SoapClient::__getLastRequestHeaders' => ['string'],
'SoapClient::__getLastResponse' => ['string'],
'SoapClient::__getLastResponseHeaders' => ['string'],
'SoapClient::__getTypes' => ['array'],
'SoapClient::__getFunctions' => ['?array'],
'SoapClient::__getLastRequest' => ['?string'],
'SoapClient::__getLastRequestHeaders' => ['?string'],
'SoapClient::__getLastResponse' => ['?string'],
'SoapClient::__getLastResponseHeaders' => ['?string'],
'SoapClient::__getTypes' => ['?array'],
'SoapClient::__setCookie' => ['', 'name'=>'string', 'value='=>'string'],
'SoapClient::__setLocation' => ['string', 'new_location='=>'string'],
'SoapClient::__setSoapHeaders' => ['bool', 'soapheaders='=>''],
'SoapClient::__soapCall' => ['', 'function_name'=>'string', 'arguments'=>'array', 'options='=>'array', 'input_headers='=>'SoapHeader|array', '&w_output_headers='=>'array'],
'SoapClient::SoapClient' => ['object', 'wsdl'=>'mixed', 'options='=>'array|null'],
'SoapFault::__clone' => ['void'],
'SoapFault::__construct' => ['void', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
'SoapFault::__construct' => ['void', 'code'=>'array|string|null', 'string'=>'string', 'actor='=>'?string', 'details='=>'?mixed', 'name='=>'?string', 'headerFault='=>'?mixed'],
'SoapFault::__toString' => ['string'],
'SoapFault::__wakeup' => ['void'],
'SoapFault::getCode' => ['int'],
Expand All @@ -12266,7 +12266,7 @@
'SoapFault::getPrevious' => ['?Exception|?Throwable'],
'SoapFault::getTrace' => ['list<array<string,mixed>>'],
'SoapFault::getTraceAsString' => ['string'],
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'?string', 'detail='=>'?mixed', 'faultname='=>'?string', 'headerfault='=>'?mixed'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the details is ok, but the other props also don't seem to match the signature of SoapFault::__construct()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the constructor signature according to the documentation. And also the property map has been updated.

Copy link
Contributor

@veewee veewee Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orklah : Do the names of these parameters matter (e.g. for named params)?
Since It is actually:

#[Pure]
public function __construct(
        array|string|null $code,
        string $string, 
        ?string $actor = null,
        mixed $details = null,
        ?string $name = null,
        mixed $headerFault = null
    ) {

See:

(It is more like an internal exception though, but maybe you'dd be creating it for testing purpose)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names do matter, for when Psalm checks calls with named arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the signatures for SoapFault::__construct() and SoapFault::SoapFault().

'SoapHeader::__construct' => ['void', 'namespace'=>'string', 'name'=>'string', 'data='=>'mixed', 'mustunderstand='=>'bool', 'actor='=>'string'],
'SoapHeader::SoapHeader' => ['object', 'namespace'=>'string', 'name'=>'string', 'data='=>'mixed', 'mustunderstand='=>'bool', 'actor='=>'string'],
'SoapParam::__construct' => ['void', 'data'=>'mixed', 'name'=>'string'],
Expand Down
16 changes: 8 additions & 8 deletions dictionaries/CallMap_historical.php
Expand Up @@ -6823,19 +6823,19 @@
'SoapClient::__construct' => ['void', 'wsdl'=>'mixed', 'options='=>'array|null'],
'SoapClient::__doRequest' => ['?string', 'request'=>'string', 'location'=>'string', 'action'=>'string', 'version'=>'int', 'one_way='=>'int'],
'SoapClient::__getCookies' => ['array'],
'SoapClient::__getFunctions' => ['array'],
'SoapClient::__getLastRequest' => ['string'],
'SoapClient::__getLastRequestHeaders' => ['string'],
'SoapClient::__getLastResponse' => ['string'],
'SoapClient::__getLastResponseHeaders' => ['string'],
'SoapClient::__getTypes' => ['array'],
'SoapClient::__getFunctions' => ['?array'],
'SoapClient::__getLastRequest' => ['?string'],
'SoapClient::__getLastRequestHeaders' => ['?string'],
'SoapClient::__getLastResponse' => ['?string'],
'SoapClient::__getLastResponseHeaders' => ['?string'],
'SoapClient::__getTypes' => ['?array'],
'SoapClient::__setCookie' => ['', 'name'=>'string', 'value='=>'string'],
'SoapClient::__setLocation' => ['string', 'new_location='=>'string'],
'SoapClient::__setSoapHeaders' => ['bool', 'soapheaders='=>''],
'SoapClient::__soapCall' => ['', 'function_name'=>'string', 'arguments'=>'array', 'options='=>'array', 'input_headers='=>'SoapHeader|array', '&w_output_headers='=>'array'],
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'?string', 'detail='=>'?mixed', 'faultname='=>'?string', 'headerfault='=>'?mixed'],
'SoapFault::__clone' => ['void'],
'SoapFault::__construct' => ['void', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
'SoapFault::__construct' => ['void', 'code'=>'array|string|null', 'string'=>'string', 'actor='=>'?string', 'details='=>'?mixed', 'name='=>'?string', 'headerFault='=>'?mixed'],
'SoapFault::__toString' => ['string'],
'SoapFault::__wakeup' => ['void'],
'SoapFault::getCode' => ['int'],
Expand Down
9 changes: 5 additions & 4 deletions dictionaries/PropertyMap.php
Expand Up @@ -527,11 +527,12 @@
'headers' => 'array<string, string>|null',
],
'soapfault' => [
'faultcode' => 'string',
'faultcode' => 'string|null',
'faultcodens' => 'string|null',
'faultstring' => 'string',
'faultactor' => 'string',
'detail' => 'string',
'faultactor' => 'string|null',
'detail' => 'mixed|null',
'_name' => 'string',
'headerfault' => 'string',
'headerfault' => 'mixed|null',
],
];
12 changes: 6 additions & 6 deletions stubs/soap.phpstub
Expand Up @@ -189,39 +189,39 @@ class SoapClient {
/**
* Returns last SOAP request
* @link https://php.net/manual/en/soapclient.getlastrequest.php
* @return string The last SOAP request, as an XML string.
* @return string|null The last SOAP request, as an XML string.
* @since 5.0.1
*/
public function __getLastRequest () {}

/**
* Returns last SOAP response
* @link https://php.net/manual/en/soapclient.getlastresponse.php
* @return string The last SOAP response, as an XML string.
* @return string|null The last SOAP response, as an XML string.
* @since 5.0.1
*/
public function __getLastResponse () {}

/**
* Returns the SOAP headers from the last request
* @link https://php.net/manual/en/soapclient.getlastrequestheaders.php
* @return string The last SOAP request headers.
* @return string|null The last SOAP request headers.
* @since 5.0.1
*/
public function __getLastRequestHeaders () {}

/**
* Returns the SOAP headers from the last response
* @link https://php.net/manual/en/soapclient.getlastresponseheaders.php
* @return string The last SOAP response headers.
* @return string|null The last SOAP response headers.
* @since 5.0.1
*/
public function __getLastResponseHeaders () {}

/**
* Returns list of available SOAP functions
* @link https://php.net/manual/en/soapclient.getfunctions.php
* @return array The array of SOAP function prototypes, detailing the return type,
* @return array|null The array of SOAP function prototypes, detailing the return type,
* the function name and type-hinted parameters.
* @since 5.0.1
*/
Expand All @@ -230,7 +230,7 @@ class SoapClient {
/**
* Returns a list of SOAP types
* @link https://php.net/manual/en/soapclient.gettypes.php
* @return array The array of SOAP types, detailing all structures and types.
* @return array|null The array of SOAP types, detailing all structures and types.
* @since 5.0.1
*/
public function __getTypes () {}
Expand Down